
obj/user/sendpage.debug:     file format elf32-i386


Disassembly of section .text:

00800020 <_start>:
// starts us running when we are initially loaded into a new environment.
.text
.globl _start
_start:
	// See if we were started with arguments on the stack
	cmpl $USTACKTOP, %esp
  800020:	81 fc 00 e0 bf ee    	cmp    $0xeebfe000,%esp
	jne args_exist
  800026:	75 04                	jne    80002c <args_exist>

	// If not, push dummy argc/argv arguments.
	// This happens when we are loaded by the kernel,
	// because the kernel does not know about passing arguments.
	pushl $0
  800028:	6a 00                	push   $0x0
	pushl $0
  80002a:	6a 00                	push   $0x0

0080002c <args_exist>:

args_exist:
	call libmain
  80002c:	e8 77 01 00 00       	call   8001a8 <libmain>
1:	jmp 1b
  800031:	eb fe                	jmp    800031 <args_exist+0x5>

00800033 <umain>:
#define TEMP_ADDR	((char*)0xa00000)
#define TEMP_ADDR_CHILD	((char*)0xb00000)

void
umain(int argc, char **argv)
{
  800033:	f3 0f 1e fb          	endbr32 
  800037:	55                   	push   %ebp
  800038:	89 e5                	mov    %esp,%ebp
  80003a:	83 ec 18             	sub    $0x18,%esp
	envid_t who;

	if ((who = fork()) == 0) {
  80003d:	e8 c7 0f 00 00       	call   801009 <fork>
  800042:	89 45 f4             	mov    %eax,-0xc(%ebp)
  800045:	85 c0                	test   %eax,%eax
  800047:	0f 84 a5 00 00 00    	je     8000f2 <umain+0xbf>
		ipc_send(who, 0, TEMP_ADDR_CHILD, PTE_P | PTE_W | PTE_U);
		return;
	}

	// Parent
	sys_page_alloc(thisenv->env_id, TEMP_ADDR, PTE_P | PTE_W | PTE_U);
  80004d:	a1 04 40 80 00       	mov    0x804004,%eax
  800052:	8b 40 48             	mov    0x48(%eax),%eax
  800055:	83 ec 04             	sub    $0x4,%esp
  800058:	6a 07                	push   $0x7
  80005a:	68 00 00 a0 00       	push   $0xa00000
  80005f:	50                   	push   %eax
  800060:	e8 6d 0c 00 00       	call   800cd2 <sys_page_alloc>
	memcpy(TEMP_ADDR, str1, strlen(str1) + 1);
  800065:	83 c4 04             	add    $0x4,%esp
  800068:	ff 35 04 30 80 00    	pushl  0x803004
  80006e:	e8 da 07 00 00       	call   80084d <strlen>
  800073:	83 c4 0c             	add    $0xc,%esp
  800076:	83 c0 01             	add    $0x1,%eax
  800079:	50                   	push   %eax
  80007a:	ff 35 04 30 80 00    	pushl  0x803004
  800080:	68 00 00 a0 00       	push   $0xa00000
  800085:	e8 22 0a 00 00       	call   800aac <memcpy>
	ipc_send(who, 0, TEMP_ADDR, PTE_P | PTE_W | PTE_U);
  80008a:	6a 07                	push   $0x7
  80008c:	68 00 00 a0 00       	push   $0xa00000
  800091:	6a 00                	push   $0x0
  800093:	ff 75 f4             	pushl  -0xc(%ebp)
  800096:	e8 0a 12 00 00       	call   8012a5 <ipc_send>

	ipc_recv(&who, TEMP_ADDR, 0);
  80009b:	83 c4 1c             	add    $0x1c,%esp
  80009e:	6a 00                	push   $0x0
  8000a0:	68 00 00 a0 00       	push   $0xa00000
  8000a5:	8d 45 f4             	lea    -0xc(%ebp),%eax
  8000a8:	50                   	push   %eax
  8000a9:	e8 76 11 00 00       	call   801224 <ipc_recv>
	cprintf("%x got message: %s\n", who, TEMP_ADDR);
  8000ae:	83 c4 0c             	add    $0xc,%esp
  8000b1:	68 00 00 a0 00       	push   $0xa00000
  8000b6:	ff 75 f4             	pushl  -0xc(%ebp)
  8000b9:	68 20 24 80 00       	push   $0x802420
  8000be:	e8 f4 01 00 00       	call   8002b7 <cprintf>
	if (strncmp(TEMP_ADDR, str2, strlen(str2)) == 0)
  8000c3:	83 c4 04             	add    $0x4,%esp
  8000c6:	ff 35 00 30 80 00    	pushl  0x803000
  8000cc:	e8 7c 07 00 00       	call   80084d <strlen>
  8000d1:	83 c4 0c             	add    $0xc,%esp
  8000d4:	50                   	push   %eax
  8000d5:	ff 35 00 30 80 00    	pushl  0x803000
  8000db:	68 00 00 a0 00       	push   $0xa00000
  8000e0:	e8 94 08 00 00       	call   800979 <strncmp>
  8000e5:	83 c4 10             	add    $0x10,%esp
  8000e8:	85 c0                	test   %eax,%eax
  8000ea:	0f 84 a3 00 00 00    	je     800193 <umain+0x160>
		cprintf("parent received correct message\n");
	return;
}
  8000f0:	c9                   	leave  
  8000f1:	c3                   	ret    
		ipc_recv(&who, TEMP_ADDR_CHILD, 0);
  8000f2:	83 ec 04             	sub    $0x4,%esp
  8000f5:	6a 00                	push   $0x0
  8000f7:	68 00 00 b0 00       	push   $0xb00000
  8000fc:	8d 45 f4             	lea    -0xc(%ebp),%eax
  8000ff:	50                   	push   %eax
  800100:	e8 1f 11 00 00       	call   801224 <ipc_recv>
		cprintf("%x got message: %s\n", who, TEMP_ADDR_CHILD);
  800105:	83 c4 0c             	add    $0xc,%esp
  800108:	68 00 00 b0 00       	push   $0xb00000
  80010d:	ff 75 f4             	pushl  -0xc(%ebp)
  800110:	68 20 24 80 00       	push   $0x802420
  800115:	e8 9d 01 00 00       	call   8002b7 <cprintf>
		if (strncmp(TEMP_ADDR_CHILD, str1, strlen(str1)) == 0)
  80011a:	83 c4 04             	add    $0x4,%esp
  80011d:	ff 35 04 30 80 00    	pushl  0x803004
  800123:	e8 25 07 00 00       	call   80084d <strlen>
  800128:	83 c4 0c             	add    $0xc,%esp
  80012b:	50                   	push   %eax
  80012c:	ff 35 04 30 80 00    	pushl  0x803004
  800132:	68 00 00 b0 00       	push   $0xb00000
  800137:	e8 3d 08 00 00       	call   800979 <strncmp>
  80013c:	83 c4 10             	add    $0x10,%esp
  80013f:	85 c0                	test   %eax,%eax
  800141:	74 3e                	je     800181 <umain+0x14e>
		memcpy(TEMP_ADDR_CHILD, str2, strlen(str2) + 1);
  800143:	83 ec 0c             	sub    $0xc,%esp
  800146:	ff 35 00 30 80 00    	pushl  0x803000
  80014c:	e8 fc 06 00 00       	call   80084d <strlen>
  800151:	83 c4 0c             	add    $0xc,%esp
  800154:	83 c0 01             	add    $0x1,%eax
  800157:	50                   	push   %eax
  800158:	ff 35 00 30 80 00    	pushl  0x803000
  80015e:	68 00 00 b0 00       	push   $0xb00000
  800163:	e8 44 09 00 00       	call   800aac <memcpy>
		ipc_send(who, 0, TEMP_ADDR_CHILD, PTE_P | PTE_W | PTE_U);
  800168:	6a 07                	push   $0x7
  80016a:	68 00 00 b0 00       	push   $0xb00000
  80016f:	6a 00                	push   $0x0
  800171:	ff 75 f4             	pushl  -0xc(%ebp)
  800174:	e8 2c 11 00 00       	call   8012a5 <ipc_send>
		return;
  800179:	83 c4 20             	add    $0x20,%esp
  80017c:	e9 6f ff ff ff       	jmp    8000f0 <umain+0xbd>
			cprintf("child received correct message\n");
  800181:	83 ec 0c             	sub    $0xc,%esp
  800184:	68 34 24 80 00       	push   $0x802434
  800189:	e8 29 01 00 00       	call   8002b7 <cprintf>
  80018e:	83 c4 10             	add    $0x10,%esp
  800191:	eb b0                	jmp    800143 <umain+0x110>
		cprintf("parent received correct message\n");
  800193:	83 ec 0c             	sub    $0xc,%esp
  800196:	68 54 24 80 00       	push   $0x802454
  80019b:	e8 17 01 00 00       	call   8002b7 <cprintf>
  8001a0:	83 c4 10             	add    $0x10,%esp
  8001a3:	e9 48 ff ff ff       	jmp    8000f0 <umain+0xbd>

008001a8 <libmain>:
const volatile struct Env *thisenv;
const char *binaryname = "<unknown>";

void
libmain(int argc, char **argv)
{
  8001a8:	f3 0f 1e fb          	endbr32 
  8001ac:	55                   	push   %ebp
  8001ad:	89 e5                	mov    %esp,%ebp
  8001af:	56                   	push   %esi
  8001b0:	53                   	push   %ebx
  8001b1:	8b 5d 08             	mov    0x8(%ebp),%ebx
  8001b4:	8b 75 0c             	mov    0xc(%ebp),%esi
	;    //系统调用，我们已经在Exercise 7中实现了
	
	
	
	//屏幕上打印出来了字母，但后续报错了，有意思，让我看看问题出现在哪。
	thisenv=0;
  8001b7:	c7 05 04 40 80 00 00 	movl   $0x0,0x804004
  8001be:	00 00 00 
	thisenv = &envs[ENVX(sys_getenvid())];      //获取Env结构指针
  8001c1:	e8 c6 0a 00 00       	call   800c8c <sys_getenvid>
  8001c6:	25 ff 03 00 00       	and    $0x3ff,%eax
  8001cb:	6b c0 7c             	imul   $0x7c,%eax,%eax
  8001ce:	05 00 00 c0 ee       	add    $0xeec00000,%eax
  8001d3:	a3 04 40 80 00       	mov    %eax,0x804004

	// save the name of the program so that panic() can use it
	if (argc > 0)
  8001d8:	85 db                	test   %ebx,%ebx
  8001da:	7e 07                	jle    8001e3 <libmain+0x3b>
		binaryname = argv[0];
  8001dc:	8b 06                	mov    (%esi),%eax
  8001de:	a3 08 30 80 00       	mov    %eax,0x803008

	// call user main routine
	umain(argc, argv);
  8001e3:	83 ec 08             	sub    $0x8,%esp
  8001e6:	56                   	push   %esi
  8001e7:	53                   	push   %ebx
  8001e8:	e8 46 fe ff ff       	call   800033 <umain>

	// exit gracefully
	exit();
  8001ed:	e8 0a 00 00 00       	call   8001fc <exit>
}
  8001f2:	83 c4 10             	add    $0x10,%esp
  8001f5:	8d 65 f8             	lea    -0x8(%ebp),%esp
  8001f8:	5b                   	pop    %ebx
  8001f9:	5e                   	pop    %esi
  8001fa:	5d                   	pop    %ebp
  8001fb:	c3                   	ret    

008001fc <exit>:

#include <inc/lib.h>

void
exit(void)
{
  8001fc:	f3 0f 1e fb          	endbr32 
  800200:	55                   	push   %ebp
  800201:	89 e5                	mov    %esp,%ebp
  800203:	83 ec 08             	sub    $0x8,%esp
	close_all();
  800206:	e8 1e 13 00 00       	call   801529 <close_all>
	sys_env_destroy(0);
  80020b:	83 ec 0c             	sub    $0xc,%esp
  80020e:	6a 00                	push   $0x0
  800210:	e8 32 0a 00 00       	call   800c47 <sys_env_destroy>
}
  800215:	83 c4 10             	add    $0x10,%esp
  800218:	c9                   	leave  
  800219:	c3                   	ret    

0080021a <putch>:
};


static void
putch(int ch, struct printbuf *b)
{
  80021a:	f3 0f 1e fb          	endbr32 
  80021e:	55                   	push   %ebp
  80021f:	89 e5                	mov    %esp,%ebp
  800221:	53                   	push   %ebx
  800222:	83 ec 04             	sub    $0x4,%esp
  800225:	8b 5d 0c             	mov    0xc(%ebp),%ebx
	b->buf[b->idx++] = ch;
  800228:	8b 13                	mov    (%ebx),%edx
  80022a:	8d 42 01             	lea    0x1(%edx),%eax
  80022d:	89 03                	mov    %eax,(%ebx)
  80022f:	8b 4d 08             	mov    0x8(%ebp),%ecx
  800232:	88 4c 13 08          	mov    %cl,0x8(%ebx,%edx,1)
	if (b->idx == 256-1) {
  800236:	3d ff 00 00 00       	cmp    $0xff,%eax
  80023b:	74 09                	je     800246 <putch+0x2c>
		sys_cputs(b->buf, b->idx);
		b->idx = 0;
	}
	b->cnt++;
  80023d:	83 43 04 01          	addl   $0x1,0x4(%ebx)
}
  800241:	8b 5d fc             	mov    -0x4(%ebp),%ebx
  800244:	c9                   	leave  
  800245:	c3                   	ret    
		sys_cputs(b->buf, b->idx);
  800246:	83 ec 08             	sub    $0x8,%esp
  800249:	68 ff 00 00 00       	push   $0xff
  80024e:	8d 43 08             	lea    0x8(%ebx),%eax
  800251:	50                   	push   %eax
  800252:	e8 ab 09 00 00       	call   800c02 <sys_cputs>
		b->idx = 0;
  800257:	c7 03 00 00 00 00    	movl   $0x0,(%ebx)
  80025d:	83 c4 10             	add    $0x10,%esp
  800260:	eb db                	jmp    80023d <putch+0x23>

00800262 <vcprintf>:

int
vcprintf(const char *fmt, va_list ap)
{
  800262:	f3 0f 1e fb          	endbr32 
  800266:	55                   	push   %ebp
  800267:	89 e5                	mov    %esp,%ebp
  800269:	81 ec 18 01 00 00    	sub    $0x118,%esp
	struct printbuf b;

	b.idx = 0;
  80026f:	c7 85 f0 fe ff ff 00 	movl   $0x0,-0x110(%ebp)
  800276:	00 00 00 
	b.cnt = 0;
  800279:	c7 85 f4 fe ff ff 00 	movl   $0x0,-0x10c(%ebp)
  800280:	00 00 00 
	vprintfmt((void*)putch, &b, fmt, ap);
  800283:	ff 75 0c             	pushl  0xc(%ebp)
  800286:	ff 75 08             	pushl  0x8(%ebp)
  800289:	8d 85 f0 fe ff ff    	lea    -0x110(%ebp),%eax
  80028f:	50                   	push   %eax
  800290:	68 1a 02 80 00       	push   $0x80021a
  800295:	e8 20 01 00 00       	call   8003ba <vprintfmt>
	sys_cputs(b.buf, b.idx);
  80029a:	83 c4 08             	add    $0x8,%esp
  80029d:	ff b5 f0 fe ff ff    	pushl  -0x110(%ebp)
  8002a3:	8d 85 f8 fe ff ff    	lea    -0x108(%ebp),%eax
  8002a9:	50                   	push   %eax
  8002aa:	e8 53 09 00 00       	call   800c02 <sys_cputs>

	return b.cnt;
}
  8002af:	8b 85 f4 fe ff ff    	mov    -0x10c(%ebp),%eax
  8002b5:	c9                   	leave  
  8002b6:	c3                   	ret    

008002b7 <cprintf>:

int
cprintf(const char *fmt, ...)
{
  8002b7:	f3 0f 1e fb          	endbr32 
  8002bb:	55                   	push   %ebp
  8002bc:	89 e5                	mov    %esp,%ebp
  8002be:	83 ec 10             	sub    $0x10,%esp
	va_list ap;
	int cnt;

	va_start(ap, fmt);
  8002c1:	8d 45 0c             	lea    0xc(%ebp),%eax
	cnt = vcprintf(fmt, ap);
  8002c4:	50                   	push   %eax
  8002c5:	ff 75 08             	pushl  0x8(%ebp)
  8002c8:	e8 95 ff ff ff       	call   800262 <vcprintf>
	va_end(ap);

	return cnt;
}
  8002cd:	c9                   	leave  
  8002ce:	c3                   	ret    

008002cf <printnum>:
 * using specified putch function and associated pointer putdat.
 */
static void
printnum(void (*putch)(int, void*), void *putdat,
	 unsigned long long num, unsigned base, int width, int padc)
{
  8002cf:	55                   	push   %ebp
  8002d0:	89 e5                	mov    %esp,%ebp
  8002d2:	57                   	push   %edi
  8002d3:	56                   	push   %esi
  8002d4:	53                   	push   %ebx
  8002d5:	83 ec 1c             	sub    $0x1c,%esp
  8002d8:	89 c7                	mov    %eax,%edi
  8002da:	89 d6                	mov    %edx,%esi
  8002dc:	8b 45 08             	mov    0x8(%ebp),%eax
  8002df:	8b 55 0c             	mov    0xc(%ebp),%edx
  8002e2:	89 d1                	mov    %edx,%ecx
  8002e4:	89 c2                	mov    %eax,%edx
  8002e6:	89 45 d8             	mov    %eax,-0x28(%ebp)
  8002e9:	89 4d dc             	mov    %ecx,-0x24(%ebp)
  8002ec:	8b 45 10             	mov    0x10(%ebp),%eax
  8002ef:	8b 5d 14             	mov    0x14(%ebp),%ebx
	// first recursively print all preceding (more significant) digits
	if (num >= base) {
  8002f2:	89 45 e0             	mov    %eax,-0x20(%ebp)
  8002f5:	c7 45 e4 00 00 00 00 	movl   $0x0,-0x1c(%ebp)
  8002fc:	39 c2                	cmp    %eax,%edx
  8002fe:	1b 4d e4             	sbb    -0x1c(%ebp),%ecx
  800301:	72 3e                	jb     800341 <printnum+0x72>
		printnum(putch, putdat, num / base, base, width - 1, padc);
  800303:	83 ec 0c             	sub    $0xc,%esp
  800306:	ff 75 18             	pushl  0x18(%ebp)
  800309:	83 eb 01             	sub    $0x1,%ebx
  80030c:	53                   	push   %ebx
  80030d:	50                   	push   %eax
  80030e:	83 ec 08             	sub    $0x8,%esp
  800311:	ff 75 e4             	pushl  -0x1c(%ebp)
  800314:	ff 75 e0             	pushl  -0x20(%ebp)
  800317:	ff 75 dc             	pushl  -0x24(%ebp)
  80031a:	ff 75 d8             	pushl  -0x28(%ebp)
  80031d:	e8 8e 1e 00 00       	call   8021b0 <__udivdi3>
  800322:	83 c4 18             	add    $0x18,%esp
  800325:	52                   	push   %edx
  800326:	50                   	push   %eax
  800327:	89 f2                	mov    %esi,%edx
  800329:	89 f8                	mov    %edi,%eax
  80032b:	e8 9f ff ff ff       	call   8002cf <printnum>
  800330:	83 c4 20             	add    $0x20,%esp
  800333:	eb 13                	jmp    800348 <printnum+0x79>
	} else {
		// print any needed pad characters before first digit
		while (--width > 0)
			putch(padc, putdat);
  800335:	83 ec 08             	sub    $0x8,%esp
  800338:	56                   	push   %esi
  800339:	ff 75 18             	pushl  0x18(%ebp)
  80033c:	ff d7                	call   *%edi
  80033e:	83 c4 10             	add    $0x10,%esp
		while (--width > 0)
  800341:	83 eb 01             	sub    $0x1,%ebx
  800344:	85 db                	test   %ebx,%ebx
  800346:	7f ed                	jg     800335 <printnum+0x66>
	}

	// then print this (the least significant) digit
	putch("0123456789abcdef"[num % base], putdat);
  800348:	83 ec 08             	sub    $0x8,%esp
  80034b:	56                   	push   %esi
  80034c:	83 ec 04             	sub    $0x4,%esp
  80034f:	ff 75 e4             	pushl  -0x1c(%ebp)
  800352:	ff 75 e0             	pushl  -0x20(%ebp)
  800355:	ff 75 dc             	pushl  -0x24(%ebp)
  800358:	ff 75 d8             	pushl  -0x28(%ebp)
  80035b:	e8 60 1f 00 00       	call   8022c0 <__umoddi3>
  800360:	83 c4 14             	add    $0x14,%esp
  800363:	0f be 80 cc 24 80 00 	movsbl 0x8024cc(%eax),%eax
  80036a:	50                   	push   %eax
  80036b:	ff d7                	call   *%edi
}
  80036d:	83 c4 10             	add    $0x10,%esp
  800370:	8d 65 f4             	lea    -0xc(%ebp),%esp
  800373:	5b                   	pop    %ebx
  800374:	5e                   	pop    %esi
  800375:	5f                   	pop    %edi
  800376:	5d                   	pop    %ebp
  800377:	c3                   	ret    

00800378 <sprintputch>:
	int cnt;
};

static void
sprintputch(int ch, struct sprintbuf *b)
{
  800378:	f3 0f 1e fb          	endbr32 
  80037c:	55                   	push   %ebp
  80037d:	89 e5                	mov    %esp,%ebp
  80037f:	8b 45 0c             	mov    0xc(%ebp),%eax
	b->cnt++;
  800382:	83 40 08 01          	addl   $0x1,0x8(%eax)
	if (b->buf < b->ebuf)
  800386:	8b 10                	mov    (%eax),%edx
  800388:	3b 50 04             	cmp    0x4(%eax),%edx
  80038b:	73 0a                	jae    800397 <sprintputch+0x1f>
		*b->buf++ = ch;
  80038d:	8d 4a 01             	lea    0x1(%edx),%ecx
  800390:	89 08                	mov    %ecx,(%eax)
  800392:	8b 45 08             	mov    0x8(%ebp),%eax
  800395:	88 02                	mov    %al,(%edx)
}
  800397:	5d                   	pop    %ebp
  800398:	c3                   	ret    

00800399 <printfmt>:
{
  800399:	f3 0f 1e fb          	endbr32 
  80039d:	55                   	push   %ebp
  80039e:	89 e5                	mov    %esp,%ebp
  8003a0:	83 ec 08             	sub    $0x8,%esp
	va_start(ap, fmt);
  8003a3:	8d 45 14             	lea    0x14(%ebp),%eax
	vprintfmt(putch, putdat, fmt, ap);
  8003a6:	50                   	push   %eax
  8003a7:	ff 75 10             	pushl  0x10(%ebp)
  8003aa:	ff 75 0c             	pushl  0xc(%ebp)
  8003ad:	ff 75 08             	pushl  0x8(%ebp)
  8003b0:	e8 05 00 00 00       	call   8003ba <vprintfmt>
}
  8003b5:	83 c4 10             	add    $0x10,%esp
  8003b8:	c9                   	leave  
  8003b9:	c3                   	ret    

008003ba <vprintfmt>:
{
  8003ba:	f3 0f 1e fb          	endbr32 
  8003be:	55                   	push   %ebp
  8003bf:	89 e5                	mov    %esp,%ebp
  8003c1:	57                   	push   %edi
  8003c2:	56                   	push   %esi
  8003c3:	53                   	push   %ebx
  8003c4:	83 ec 3c             	sub    $0x3c,%esp
  8003c7:	8b 75 08             	mov    0x8(%ebp),%esi
  8003ca:	8b 5d 0c             	mov    0xc(%ebp),%ebx
  8003cd:	8b 7d 10             	mov    0x10(%ebp),%edi
  8003d0:	e9 5d 03 00 00       	jmp    800732 <vprintfmt+0x378>
		padc = ' ';
  8003d5:	c6 45 d3 20          	movb   $0x20,-0x2d(%ebp)
		altflag = 0;
  8003d9:	c7 45 e0 00 00 00 00 	movl   $0x0,-0x20(%ebp)
		precision = -1;
  8003e0:	c7 45 d8 ff ff ff ff 	movl   $0xffffffff,-0x28(%ebp)
		width = -1;
  8003e7:	c7 45 d4 ff ff ff ff 	movl   $0xffffffff,-0x2c(%ebp)
		lflag = 0;
  8003ee:	b9 00 00 00 00       	mov    $0x0,%ecx
		switch (ch = *(unsigned char *) fmt++) {
  8003f3:	8d 47 01             	lea    0x1(%edi),%eax
  8003f6:	89 45 e4             	mov    %eax,-0x1c(%ebp)
  8003f9:	0f b6 17             	movzbl (%edi),%edx
  8003fc:	8d 42 dd             	lea    -0x23(%edx),%eax
  8003ff:	3c 55                	cmp    $0x55,%al
  800401:	0f 87 ae 03 00 00    	ja     8007b5 <vprintfmt+0x3fb>
  800407:	0f b6 c0             	movzbl %al,%eax
  80040a:	3e ff 24 85 00 26 80 	notrack jmp *0x802600(,%eax,4)
  800411:	00 
  800412:	8b 7d e4             	mov    -0x1c(%ebp),%edi
			padc = '-';
  800415:	c6 45 d3 2d          	movb   $0x2d,-0x2d(%ebp)
  800419:	eb d8                	jmp    8003f3 <vprintfmt+0x39>
		switch (ch = *(unsigned char *) fmt++) {
  80041b:	8b 7d e4             	mov    -0x1c(%ebp),%edi
  80041e:	c6 45 d3 30          	movb   $0x30,-0x2d(%ebp)
  800422:	eb cf                	jmp    8003f3 <vprintfmt+0x39>
  800424:	0f b6 d2             	movzbl %dl,%edx
  800427:	8b 7d e4             	mov    -0x1c(%ebp),%edi
			for (precision = 0; ; ++fmt) {
  80042a:	b8 00 00 00 00       	mov    $0x0,%eax
  80042f:	89 4d e4             	mov    %ecx,-0x1c(%ebp)
				precision = precision * 10 + ch - '0';
  800432:	8d 04 80             	lea    (%eax,%eax,4),%eax
  800435:	8d 44 42 d0          	lea    -0x30(%edx,%eax,2),%eax
				ch = *fmt;
  800439:	0f be 17             	movsbl (%edi),%edx
				if (ch < '0' || ch > '9')
  80043c:	8d 4a d0             	lea    -0x30(%edx),%ecx
  80043f:	83 f9 09             	cmp    $0x9,%ecx
  800442:	77 55                	ja     800499 <vprintfmt+0xdf>
			for (precision = 0; ; ++fmt) {
  800444:	83 c7 01             	add    $0x1,%edi
				precision = precision * 10 + ch - '0';
  800447:	eb e9                	jmp    800432 <vprintfmt+0x78>
			precision = va_arg(ap, int);
  800449:	8b 45 14             	mov    0x14(%ebp),%eax
  80044c:	8b 00                	mov    (%eax),%eax
  80044e:	89 45 d8             	mov    %eax,-0x28(%ebp)
  800451:	8b 45 14             	mov    0x14(%ebp),%eax
  800454:	8d 40 04             	lea    0x4(%eax),%eax
  800457:	89 45 14             	mov    %eax,0x14(%ebp)
		switch (ch = *(unsigned char *) fmt++) {
  80045a:	8b 7d e4             	mov    -0x1c(%ebp),%edi
			if (width < 0)
  80045d:	83 7d d4 00          	cmpl   $0x0,-0x2c(%ebp)
  800461:	79 90                	jns    8003f3 <vprintfmt+0x39>
				width = precision, precision = -1;
  800463:	8b 45 d8             	mov    -0x28(%ebp),%eax
  800466:	89 45 d4             	mov    %eax,-0x2c(%ebp)
  800469:	c7 45 d8 ff ff ff ff 	movl   $0xffffffff,-0x28(%ebp)
  800470:	eb 81                	jmp    8003f3 <vprintfmt+0x39>
  800472:	8b 45 d4             	mov    -0x2c(%ebp),%eax
  800475:	85 c0                	test   %eax,%eax
  800477:	ba 00 00 00 00       	mov    $0x0,%edx
  80047c:	0f 49 d0             	cmovns %eax,%edx
  80047f:	89 55 d4             	mov    %edx,-0x2c(%ebp)
		switch (ch = *(unsigned char *) fmt++) {
  800482:	8b 7d e4             	mov    -0x1c(%ebp),%edi
			goto reswitch;
  800485:	e9 69 ff ff ff       	jmp    8003f3 <vprintfmt+0x39>
		switch (ch = *(unsigned char *) fmt++) {
  80048a:	8b 7d e4             	mov    -0x1c(%ebp),%edi
			altflag = 1;
  80048d:	c7 45 e0 01 00 00 00 	movl   $0x1,-0x20(%ebp)
			goto reswitch;
  800494:	e9 5a ff ff ff       	jmp    8003f3 <vprintfmt+0x39>
  800499:	8b 4d e4             	mov    -0x1c(%ebp),%ecx
  80049c:	89 45 d8             	mov    %eax,-0x28(%ebp)
  80049f:	eb bc                	jmp    80045d <vprintfmt+0xa3>
			lflag++;
  8004a1:	83 c1 01             	add    $0x1,%ecx
		switch (ch = *(unsigned char *) fmt++) {
  8004a4:	8b 7d e4             	mov    -0x1c(%ebp),%edi
			goto reswitch;
  8004a7:	e9 47 ff ff ff       	jmp    8003f3 <vprintfmt+0x39>
			putch(va_arg(ap, int), putdat);
  8004ac:	8b 45 14             	mov    0x14(%ebp),%eax
  8004af:	8d 78 04             	lea    0x4(%eax),%edi
  8004b2:	83 ec 08             	sub    $0x8,%esp
  8004b5:	53                   	push   %ebx
  8004b6:	ff 30                	pushl  (%eax)
  8004b8:	ff d6                	call   *%esi
			break;
  8004ba:	83 c4 10             	add    $0x10,%esp
			putch(va_arg(ap, int), putdat);
  8004bd:	89 7d 14             	mov    %edi,0x14(%ebp)
			break;
  8004c0:	e9 6a 02 00 00       	jmp    80072f <vprintfmt+0x375>
			err = va_arg(ap, int);
  8004c5:	8b 45 14             	mov    0x14(%ebp),%eax
  8004c8:	8d 78 04             	lea    0x4(%eax),%edi
  8004cb:	8b 00                	mov    (%eax),%eax
  8004cd:	99                   	cltd   
  8004ce:	31 d0                	xor    %edx,%eax
  8004d0:	29 d0                	sub    %edx,%eax
			if (err >= MAXERROR || (p = error_string[err]) == NULL)
  8004d2:	83 f8 0f             	cmp    $0xf,%eax
  8004d5:	7f 23                	jg     8004fa <vprintfmt+0x140>
  8004d7:	8b 14 85 60 27 80 00 	mov    0x802760(,%eax,4),%edx
  8004de:	85 d2                	test   %edx,%edx
  8004e0:	74 18                	je     8004fa <vprintfmt+0x140>
				printfmt(putch, putdat, "%s", p);
  8004e2:	52                   	push   %edx
  8004e3:	68 01 2a 80 00       	push   $0x802a01
  8004e8:	53                   	push   %ebx
  8004e9:	56                   	push   %esi
  8004ea:	e8 aa fe ff ff       	call   800399 <printfmt>
  8004ef:	83 c4 10             	add    $0x10,%esp
			err = va_arg(ap, int);
  8004f2:	89 7d 14             	mov    %edi,0x14(%ebp)
  8004f5:	e9 35 02 00 00       	jmp    80072f <vprintfmt+0x375>
				printfmt(putch, putdat, "error %d", err);
  8004fa:	50                   	push   %eax
  8004fb:	68 e4 24 80 00       	push   $0x8024e4
  800500:	53                   	push   %ebx
  800501:	56                   	push   %esi
  800502:	e8 92 fe ff ff       	call   800399 <printfmt>
  800507:	83 c4 10             	add    $0x10,%esp
			err = va_arg(ap, int);
  80050a:	89 7d 14             	mov    %edi,0x14(%ebp)
				printfmt(putch, putdat, "error %d", err);
  80050d:	e9 1d 02 00 00       	jmp    80072f <vprintfmt+0x375>
			if ((p = va_arg(ap, char *)) == NULL)
  800512:	8b 45 14             	mov    0x14(%ebp),%eax
  800515:	83 c0 04             	add    $0x4,%eax
  800518:	89 45 c8             	mov    %eax,-0x38(%ebp)
  80051b:	8b 45 14             	mov    0x14(%ebp),%eax
  80051e:	8b 10                	mov    (%eax),%edx
				p = "(null)";
  800520:	85 d2                	test   %edx,%edx
  800522:	b8 dd 24 80 00       	mov    $0x8024dd,%eax
  800527:	0f 45 c2             	cmovne %edx,%eax
  80052a:	89 45 cc             	mov    %eax,-0x34(%ebp)
			if (width > 0 && padc != '-')
  80052d:	83 7d d4 00          	cmpl   $0x0,-0x2c(%ebp)
  800531:	7e 06                	jle    800539 <vprintfmt+0x17f>
  800533:	80 7d d3 2d          	cmpb   $0x2d,-0x2d(%ebp)
  800537:	75 0d                	jne    800546 <vprintfmt+0x18c>
				for (width -= strnlen(p, precision); width > 0; width--)
  800539:	8b 45 cc             	mov    -0x34(%ebp),%eax
  80053c:	89 c7                	mov    %eax,%edi
  80053e:	03 45 d4             	add    -0x2c(%ebp),%eax
  800541:	89 45 d4             	mov    %eax,-0x2c(%ebp)
  800544:	eb 55                	jmp    80059b <vprintfmt+0x1e1>
  800546:	83 ec 08             	sub    $0x8,%esp
  800549:	ff 75 d8             	pushl  -0x28(%ebp)
  80054c:	ff 75 cc             	pushl  -0x34(%ebp)
  80054f:	e8 15 03 00 00       	call   800869 <strnlen>
  800554:	8b 55 d4             	mov    -0x2c(%ebp),%edx
  800557:	29 c2                	sub    %eax,%edx
  800559:	89 55 c4             	mov    %edx,-0x3c(%ebp)
  80055c:	83 c4 10             	add    $0x10,%esp
  80055f:	89 d7                	mov    %edx,%edi
					putch(padc, putdat);
  800561:	0f be 45 d3          	movsbl -0x2d(%ebp),%eax
  800565:	89 45 d4             	mov    %eax,-0x2c(%ebp)
				for (width -= strnlen(p, precision); width > 0; width--)
  800568:	85 ff                	test   %edi,%edi
  80056a:	7e 11                	jle    80057d <vprintfmt+0x1c3>
					putch(padc, putdat);
  80056c:	83 ec 08             	sub    $0x8,%esp
  80056f:	53                   	push   %ebx
  800570:	ff 75 d4             	pushl  -0x2c(%ebp)
  800573:	ff d6                	call   *%esi
				for (width -= strnlen(p, precision); width > 0; width--)
  800575:	83 ef 01             	sub    $0x1,%edi
  800578:	83 c4 10             	add    $0x10,%esp
  80057b:	eb eb                	jmp    800568 <vprintfmt+0x1ae>
  80057d:	8b 55 c4             	mov    -0x3c(%ebp),%edx
  800580:	85 d2                	test   %edx,%edx
  800582:	b8 00 00 00 00       	mov    $0x0,%eax
  800587:	0f 49 c2             	cmovns %edx,%eax
  80058a:	29 c2                	sub    %eax,%edx
  80058c:	89 55 d4             	mov    %edx,-0x2c(%ebp)
  80058f:	eb a8                	jmp    800539 <vprintfmt+0x17f>
					putch(ch, putdat);
  800591:	83 ec 08             	sub    $0x8,%esp
  800594:	53                   	push   %ebx
  800595:	52                   	push   %edx
  800596:	ff d6                	call   *%esi
  800598:	83 c4 10             	add    $0x10,%esp
  80059b:	8b 4d d4             	mov    -0x2c(%ebp),%ecx
  80059e:	29 f9                	sub    %edi,%ecx
			for (; (ch = *p++) != '\0' && (precision < 0 || --precision >= 0); width--)
  8005a0:	83 c7 01             	add    $0x1,%edi
  8005a3:	0f b6 47 ff          	movzbl -0x1(%edi),%eax
  8005a7:	0f be d0             	movsbl %al,%edx
  8005aa:	85 d2                	test   %edx,%edx
  8005ac:	74 4b                	je     8005f9 <vprintfmt+0x23f>
  8005ae:	83 7d d8 00          	cmpl   $0x0,-0x28(%ebp)
  8005b2:	78 06                	js     8005ba <vprintfmt+0x200>
  8005b4:	83 6d d8 01          	subl   $0x1,-0x28(%ebp)
  8005b8:	78 1e                	js     8005d8 <vprintfmt+0x21e>
				if (altflag && (ch < ' ' || ch > '~'))
  8005ba:	83 7d e0 00          	cmpl   $0x0,-0x20(%ebp)
  8005be:	74 d1                	je     800591 <vprintfmt+0x1d7>
  8005c0:	0f be c0             	movsbl %al,%eax
  8005c3:	83 e8 20             	sub    $0x20,%eax
  8005c6:	83 f8 5e             	cmp    $0x5e,%eax
  8005c9:	76 c6                	jbe    800591 <vprintfmt+0x1d7>
					putch('?', putdat);
  8005cb:	83 ec 08             	sub    $0x8,%esp
  8005ce:	53                   	push   %ebx
  8005cf:	6a 3f                	push   $0x3f
  8005d1:	ff d6                	call   *%esi
  8005d3:	83 c4 10             	add    $0x10,%esp
  8005d6:	eb c3                	jmp    80059b <vprintfmt+0x1e1>
  8005d8:	89 cf                	mov    %ecx,%edi
  8005da:	eb 0e                	jmp    8005ea <vprintfmt+0x230>
				putch(' ', putdat);
  8005dc:	83 ec 08             	sub    $0x8,%esp
  8005df:	53                   	push   %ebx
  8005e0:	6a 20                	push   $0x20
  8005e2:	ff d6                	call   *%esi
			for (; width > 0; width--)
  8005e4:	83 ef 01             	sub    $0x1,%edi
  8005e7:	83 c4 10             	add    $0x10,%esp
  8005ea:	85 ff                	test   %edi,%edi
  8005ec:	7f ee                	jg     8005dc <vprintfmt+0x222>
			if ((p = va_arg(ap, char *)) == NULL)
  8005ee:	8b 45 c8             	mov    -0x38(%ebp),%eax
  8005f1:	89 45 14             	mov    %eax,0x14(%ebp)
  8005f4:	e9 36 01 00 00       	jmp    80072f <vprintfmt+0x375>
  8005f9:	89 cf                	mov    %ecx,%edi
  8005fb:	eb ed                	jmp    8005ea <vprintfmt+0x230>
	if (lflag >= 2)
  8005fd:	83 f9 01             	cmp    $0x1,%ecx
  800600:	7f 1f                	jg     800621 <vprintfmt+0x267>
	else if (lflag)
  800602:	85 c9                	test   %ecx,%ecx
  800604:	74 67                	je     80066d <vprintfmt+0x2b3>
		return va_arg(*ap, long);
  800606:	8b 45 14             	mov    0x14(%ebp),%eax
  800609:	8b 00                	mov    (%eax),%eax
  80060b:	89 45 d8             	mov    %eax,-0x28(%ebp)
  80060e:	89 c1                	mov    %eax,%ecx
  800610:	c1 f9 1f             	sar    $0x1f,%ecx
  800613:	89 4d dc             	mov    %ecx,-0x24(%ebp)
  800616:	8b 45 14             	mov    0x14(%ebp),%eax
  800619:	8d 40 04             	lea    0x4(%eax),%eax
  80061c:	89 45 14             	mov    %eax,0x14(%ebp)
  80061f:	eb 17                	jmp    800638 <vprintfmt+0x27e>
		return va_arg(*ap, long long);
  800621:	8b 45 14             	mov    0x14(%ebp),%eax
  800624:	8b 50 04             	mov    0x4(%eax),%edx
  800627:	8b 00                	mov    (%eax),%eax
  800629:	89 45 d8             	mov    %eax,-0x28(%ebp)
  80062c:	89 55 dc             	mov    %edx,-0x24(%ebp)
  80062f:	8b 45 14             	mov    0x14(%ebp),%eax
  800632:	8d 40 08             	lea    0x8(%eax),%eax
  800635:	89 45 14             	mov    %eax,0x14(%ebp)
			if ((long long) num < 0) {
  800638:	8b 55 d8             	mov    -0x28(%ebp),%edx
  80063b:	8b 4d dc             	mov    -0x24(%ebp),%ecx
			base = 10;
  80063e:	b8 0a 00 00 00       	mov    $0xa,%eax
			if ((long long) num < 0) {
  800643:	85 c9                	test   %ecx,%ecx
  800645:	0f 89 ca 00 00 00    	jns    800715 <vprintfmt+0x35b>
				putch('-', putdat);
  80064b:	83 ec 08             	sub    $0x8,%esp
  80064e:	53                   	push   %ebx
  80064f:	6a 2d                	push   $0x2d
  800651:	ff d6                	call   *%esi
				num = -(long long) num;
  800653:	8b 55 d8             	mov    -0x28(%ebp),%edx
  800656:	8b 4d dc             	mov    -0x24(%ebp),%ecx
  800659:	f7 da                	neg    %edx
  80065b:	83 d1 00             	adc    $0x0,%ecx
  80065e:	f7 d9                	neg    %ecx
  800660:	83 c4 10             	add    $0x10,%esp
			base = 10;
  800663:	b8 0a 00 00 00       	mov    $0xa,%eax
  800668:	e9 a8 00 00 00       	jmp    800715 <vprintfmt+0x35b>
		return va_arg(*ap, int);
  80066d:	8b 45 14             	mov    0x14(%ebp),%eax
  800670:	8b 00                	mov    (%eax),%eax
  800672:	89 45 d8             	mov    %eax,-0x28(%ebp)
  800675:	99                   	cltd   
  800676:	89 55 dc             	mov    %edx,-0x24(%ebp)
  800679:	8b 45 14             	mov    0x14(%ebp),%eax
  80067c:	8d 40 04             	lea    0x4(%eax),%eax
  80067f:	89 45 14             	mov    %eax,0x14(%ebp)
  800682:	eb b4                	jmp    800638 <vprintfmt+0x27e>
	if (lflag >= 2)
  800684:	83 f9 01             	cmp    $0x1,%ecx
  800687:	7f 1b                	jg     8006a4 <vprintfmt+0x2ea>
	else if (lflag)
  800689:	85 c9                	test   %ecx,%ecx
  80068b:	74 2c                	je     8006b9 <vprintfmt+0x2ff>
		return va_arg(*ap, unsigned long);
  80068d:	8b 45 14             	mov    0x14(%ebp),%eax
  800690:	8b 10                	mov    (%eax),%edx
  800692:	b9 00 00 00 00       	mov    $0x0,%ecx
  800697:	8d 40 04             	lea    0x4(%eax),%eax
  80069a:	89 45 14             	mov    %eax,0x14(%ebp)
			base = 10;
  80069d:	b8 0a 00 00 00       	mov    $0xa,%eax
		return va_arg(*ap, unsigned long);
  8006a2:	eb 71                	jmp    800715 <vprintfmt+0x35b>
		return va_arg(*ap, unsigned long long);
  8006a4:	8b 45 14             	mov    0x14(%ebp),%eax
  8006a7:	8b 10                	mov    (%eax),%edx
  8006a9:	8b 48 04             	mov    0x4(%eax),%ecx
  8006ac:	8d 40 08             	lea    0x8(%eax),%eax
  8006af:	89 45 14             	mov    %eax,0x14(%ebp)
			base = 10;
  8006b2:	b8 0a 00 00 00       	mov    $0xa,%eax
		return va_arg(*ap, unsigned long long);
  8006b7:	eb 5c                	jmp    800715 <vprintfmt+0x35b>
		return va_arg(*ap, unsigned int);
  8006b9:	8b 45 14             	mov    0x14(%ebp),%eax
  8006bc:	8b 10                	mov    (%eax),%edx
  8006be:	b9 00 00 00 00       	mov    $0x0,%ecx
  8006c3:	8d 40 04             	lea    0x4(%eax),%eax
  8006c6:	89 45 14             	mov    %eax,0x14(%ebp)
			base = 10;
  8006c9:	b8 0a 00 00 00       	mov    $0xa,%eax
		return va_arg(*ap, unsigned int);
  8006ce:	eb 45                	jmp    800715 <vprintfmt+0x35b>
			putch('X', putdat);
  8006d0:	83 ec 08             	sub    $0x8,%esp
  8006d3:	53                   	push   %ebx
  8006d4:	6a 58                	push   $0x58
  8006d6:	ff d6                	call   *%esi
			putch('X', putdat);
  8006d8:	83 c4 08             	add    $0x8,%esp
  8006db:	53                   	push   %ebx
  8006dc:	6a 58                	push   $0x58
  8006de:	ff d6                	call   *%esi
			putch('X', putdat);
  8006e0:	83 c4 08             	add    $0x8,%esp
  8006e3:	53                   	push   %ebx
  8006e4:	6a 58                	push   $0x58
  8006e6:	ff d6                	call   *%esi
			break;
  8006e8:	83 c4 10             	add    $0x10,%esp
  8006eb:	eb 42                	jmp    80072f <vprintfmt+0x375>
			putch('0', putdat);
  8006ed:	83 ec 08             	sub    $0x8,%esp
  8006f0:	53                   	push   %ebx
  8006f1:	6a 30                	push   $0x30
  8006f3:	ff d6                	call   *%esi
			putch('x', putdat);
  8006f5:	83 c4 08             	add    $0x8,%esp
  8006f8:	53                   	push   %ebx
  8006f9:	6a 78                	push   $0x78
  8006fb:	ff d6                	call   *%esi
			num = (unsigned long long)
  8006fd:	8b 45 14             	mov    0x14(%ebp),%eax
  800700:	8b 10                	mov    (%eax),%edx
  800702:	b9 00 00 00 00       	mov    $0x0,%ecx
			goto number;
  800707:	83 c4 10             	add    $0x10,%esp
				(uintptr_t) va_arg(ap, void *);
  80070a:	8d 40 04             	lea    0x4(%eax),%eax
  80070d:	89 45 14             	mov    %eax,0x14(%ebp)
			base = 16;
  800710:	b8 10 00 00 00       	mov    $0x10,%eax
			printnum(putch, putdat, num, base, width, padc);
  800715:	83 ec 0c             	sub    $0xc,%esp
  800718:	0f be 7d d3          	movsbl -0x2d(%ebp),%edi
  80071c:	57                   	push   %edi
  80071d:	ff 75 d4             	pushl  -0x2c(%ebp)
  800720:	50                   	push   %eax
  800721:	51                   	push   %ecx
  800722:	52                   	push   %edx
  800723:	89 da                	mov    %ebx,%edx
  800725:	89 f0                	mov    %esi,%eax
  800727:	e8 a3 fb ff ff       	call   8002cf <printnum>
			break;
  80072c:	83 c4 20             	add    $0x20,%esp
			if ((p = va_arg(ap, char *)) == NULL)
  80072f:	8b 7d e4             	mov    -0x1c(%ebp),%edi
		while ((ch = *(unsigned char *) fmt++) != '%') {
  800732:	83 c7 01             	add    $0x1,%edi
  800735:	0f b6 47 ff          	movzbl -0x1(%edi),%eax
  800739:	83 f8 25             	cmp    $0x25,%eax
  80073c:	0f 84 93 fc ff ff    	je     8003d5 <vprintfmt+0x1b>
			if (ch == '\0')
  800742:	85 c0                	test   %eax,%eax
  800744:	0f 84 8b 00 00 00    	je     8007d5 <vprintfmt+0x41b>
			putch(ch, putdat);
  80074a:	83 ec 08             	sub    $0x8,%esp
  80074d:	53                   	push   %ebx
  80074e:	50                   	push   %eax
  80074f:	ff d6                	call   *%esi
  800751:	83 c4 10             	add    $0x10,%esp
  800754:	eb dc                	jmp    800732 <vprintfmt+0x378>
	if (lflag >= 2)
  800756:	83 f9 01             	cmp    $0x1,%ecx
  800759:	7f 1b                	jg     800776 <vprintfmt+0x3bc>
	else if (lflag)
  80075b:	85 c9                	test   %ecx,%ecx
  80075d:	74 2c                	je     80078b <vprintfmt+0x3d1>
		return va_arg(*ap, unsigned long);
  80075f:	8b 45 14             	mov    0x14(%ebp),%eax
  800762:	8b 10                	mov    (%eax),%edx
  800764:	b9 00 00 00 00       	mov    $0x0,%ecx
  800769:	8d 40 04             	lea    0x4(%eax),%eax
  80076c:	89 45 14             	mov    %eax,0x14(%ebp)
			base = 16;
  80076f:	b8 10 00 00 00       	mov    $0x10,%eax
		return va_arg(*ap, unsigned long);
  800774:	eb 9f                	jmp    800715 <vprintfmt+0x35b>
		return va_arg(*ap, unsigned long long);
  800776:	8b 45 14             	mov    0x14(%ebp),%eax
  800779:	8b 10                	mov    (%eax),%edx
  80077b:	8b 48 04             	mov    0x4(%eax),%ecx
  80077e:	8d 40 08             	lea    0x8(%eax),%eax
  800781:	89 45 14             	mov    %eax,0x14(%ebp)
			base = 16;
  800784:	b8 10 00 00 00       	mov    $0x10,%eax
		return va_arg(*ap, unsigned long long);
  800789:	eb 8a                	jmp    800715 <vprintfmt+0x35b>
		return va_arg(*ap, unsigned int);
  80078b:	8b 45 14             	mov    0x14(%ebp),%eax
  80078e:	8b 10                	mov    (%eax),%edx
  800790:	b9 00 00 00 00       	mov    $0x0,%ecx
  800795:	8d 40 04             	lea    0x4(%eax),%eax
  800798:	89 45 14             	mov    %eax,0x14(%ebp)
			base = 16;
  80079b:	b8 10 00 00 00       	mov    $0x10,%eax
		return va_arg(*ap, unsigned int);
  8007a0:	e9 70 ff ff ff       	jmp    800715 <vprintfmt+0x35b>
			putch(ch, putdat);
  8007a5:	83 ec 08             	sub    $0x8,%esp
  8007a8:	53                   	push   %ebx
  8007a9:	6a 25                	push   $0x25
  8007ab:	ff d6                	call   *%esi
			break;
  8007ad:	83 c4 10             	add    $0x10,%esp
  8007b0:	e9 7a ff ff ff       	jmp    80072f <vprintfmt+0x375>
			putch('%', putdat);
  8007b5:	83 ec 08             	sub    $0x8,%esp
  8007b8:	53                   	push   %ebx
  8007b9:	6a 25                	push   $0x25
  8007bb:	ff d6                	call   *%esi
			for (fmt--; fmt[-1] != '%'; fmt--)
  8007bd:	83 c4 10             	add    $0x10,%esp
  8007c0:	89 f8                	mov    %edi,%eax
  8007c2:	80 78 ff 25          	cmpb   $0x25,-0x1(%eax)
  8007c6:	74 05                	je     8007cd <vprintfmt+0x413>
  8007c8:	83 e8 01             	sub    $0x1,%eax
  8007cb:	eb f5                	jmp    8007c2 <vprintfmt+0x408>
  8007cd:	89 45 e4             	mov    %eax,-0x1c(%ebp)
  8007d0:	e9 5a ff ff ff       	jmp    80072f <vprintfmt+0x375>
}
  8007d5:	8d 65 f4             	lea    -0xc(%ebp),%esp
  8007d8:	5b                   	pop    %ebx
  8007d9:	5e                   	pop    %esi
  8007da:	5f                   	pop    %edi
  8007db:	5d                   	pop    %ebp
  8007dc:	c3                   	ret    

008007dd <vsnprintf>:

int
vsnprintf(char *buf, int n, const char *fmt, va_list ap)
{
  8007dd:	f3 0f 1e fb          	endbr32 
  8007e1:	55                   	push   %ebp
  8007e2:	89 e5                	mov    %esp,%ebp
  8007e4:	83 ec 18             	sub    $0x18,%esp
  8007e7:	8b 45 08             	mov    0x8(%ebp),%eax
  8007ea:	8b 55 0c             	mov    0xc(%ebp),%edx
	struct sprintbuf b = {buf, buf+n-1, 0};
  8007ed:	89 45 ec             	mov    %eax,-0x14(%ebp)
  8007f0:	8d 4c 10 ff          	lea    -0x1(%eax,%edx,1),%ecx
  8007f4:	89 4d f0             	mov    %ecx,-0x10(%ebp)
  8007f7:	c7 45 f4 00 00 00 00 	movl   $0x0,-0xc(%ebp)

	if (buf == NULL || n < 1)
  8007fe:	85 c0                	test   %eax,%eax
  800800:	74 26                	je     800828 <vsnprintf+0x4b>
  800802:	85 d2                	test   %edx,%edx
  800804:	7e 22                	jle    800828 <vsnprintf+0x4b>
		return -E_INVAL;

	// print the string to the buffer
	vprintfmt((void*)sprintputch, &b, fmt, ap);
  800806:	ff 75 14             	pushl  0x14(%ebp)
  800809:	ff 75 10             	pushl  0x10(%ebp)
  80080c:	8d 45 ec             	lea    -0x14(%ebp),%eax
  80080f:	50                   	push   %eax
  800810:	68 78 03 80 00       	push   $0x800378
  800815:	e8 a0 fb ff ff       	call   8003ba <vprintfmt>

	// null terminate the buffer
	*b.buf = '\0';
  80081a:	8b 45 ec             	mov    -0x14(%ebp),%eax
  80081d:	c6 00 00             	movb   $0x0,(%eax)

	return b.cnt;
  800820:	8b 45 f4             	mov    -0xc(%ebp),%eax
  800823:	83 c4 10             	add    $0x10,%esp
}
  800826:	c9                   	leave  
  800827:	c3                   	ret    
		return -E_INVAL;
  800828:	b8 fd ff ff ff       	mov    $0xfffffffd,%eax
  80082d:	eb f7                	jmp    800826 <vsnprintf+0x49>

0080082f <snprintf>:

int
snprintf(char *buf, int n, const char *fmt, ...)
{
  80082f:	f3 0f 1e fb          	endbr32 
  800833:	55                   	push   %ebp
  800834:	89 e5                	mov    %esp,%ebp
  800836:	83 ec 08             	sub    $0x8,%esp
	va_list ap;
	int rc;

	va_start(ap, fmt);
  800839:	8d 45 14             	lea    0x14(%ebp),%eax
	rc = vsnprintf(buf, n, fmt, ap);
  80083c:	50                   	push   %eax
  80083d:	ff 75 10             	pushl  0x10(%ebp)
  800840:	ff 75 0c             	pushl  0xc(%ebp)
  800843:	ff 75 08             	pushl  0x8(%ebp)
  800846:	e8 92 ff ff ff       	call   8007dd <vsnprintf>
	va_end(ap);

	return rc;
}
  80084b:	c9                   	leave  
  80084c:	c3                   	ret    

0080084d <strlen>:
// Primespipe runs 3x faster this way.
#define ASM 1

int
strlen(const char *s)
{
  80084d:	f3 0f 1e fb          	endbr32 
  800851:	55                   	push   %ebp
  800852:	89 e5                	mov    %esp,%ebp
  800854:	8b 55 08             	mov    0x8(%ebp),%edx
	int n;

	for (n = 0; *s != '\0'; s++)
  800857:	b8 00 00 00 00       	mov    $0x0,%eax
  80085c:	80 3c 02 00          	cmpb   $0x0,(%edx,%eax,1)
  800860:	74 05                	je     800867 <strlen+0x1a>
		n++;
  800862:	83 c0 01             	add    $0x1,%eax
  800865:	eb f5                	jmp    80085c <strlen+0xf>
	return n;
}
  800867:	5d                   	pop    %ebp
  800868:	c3                   	ret    

00800869 <strnlen>:

int
strnlen(const char *s, size_t size)
{
  800869:	f3 0f 1e fb          	endbr32 
  80086d:	55                   	push   %ebp
  80086e:	89 e5                	mov    %esp,%ebp
  800870:	8b 4d 08             	mov    0x8(%ebp),%ecx
  800873:	8b 55 0c             	mov    0xc(%ebp),%edx
	int n;

	for (n = 0; size > 0 && *s != '\0'; s++, size--)
  800876:	b8 00 00 00 00       	mov    $0x0,%eax
  80087b:	39 d0                	cmp    %edx,%eax
  80087d:	74 0d                	je     80088c <strnlen+0x23>
  80087f:	80 3c 01 00          	cmpb   $0x0,(%ecx,%eax,1)
  800883:	74 05                	je     80088a <strnlen+0x21>
		n++;
  800885:	83 c0 01             	add    $0x1,%eax
  800888:	eb f1                	jmp    80087b <strnlen+0x12>
  80088a:	89 c2                	mov    %eax,%edx
	return n;
}
  80088c:	89 d0                	mov    %edx,%eax
  80088e:	5d                   	pop    %ebp
  80088f:	c3                   	ret    

00800890 <strcpy>:

char *
strcpy(char *dst, const char *src)
{
  800890:	f3 0f 1e fb          	endbr32 
  800894:	55                   	push   %ebp
  800895:	89 e5                	mov    %esp,%ebp
  800897:	53                   	push   %ebx
  800898:	8b 4d 08             	mov    0x8(%ebp),%ecx
  80089b:	8b 5d 0c             	mov    0xc(%ebp),%ebx
	char *ret;

	ret = dst;
	while ((*dst++ = *src++) != '\0')
  80089e:	b8 00 00 00 00       	mov    $0x0,%eax
  8008a3:	0f b6 14 03          	movzbl (%ebx,%eax,1),%edx
  8008a7:	88 14 01             	mov    %dl,(%ecx,%eax,1)
  8008aa:	83 c0 01             	add    $0x1,%eax
  8008ad:	84 d2                	test   %dl,%dl
  8008af:	75 f2                	jne    8008a3 <strcpy+0x13>
		/* do nothing */;
	return ret;
}
  8008b1:	89 c8                	mov    %ecx,%eax
  8008b3:	5b                   	pop    %ebx
  8008b4:	5d                   	pop    %ebp
  8008b5:	c3                   	ret    

008008b6 <strcat>:

char *
strcat(char *dst, const char *src)
{
  8008b6:	f3 0f 1e fb          	endbr32 
  8008ba:	55                   	push   %ebp
  8008bb:	89 e5                	mov    %esp,%ebp
  8008bd:	53                   	push   %ebx
  8008be:	83 ec 10             	sub    $0x10,%esp
  8008c1:	8b 5d 08             	mov    0x8(%ebp),%ebx
	int len = strlen(dst);
  8008c4:	53                   	push   %ebx
  8008c5:	e8 83 ff ff ff       	call   80084d <strlen>
  8008ca:	83 c4 08             	add    $0x8,%esp
	strcpy(dst + len, src);
  8008cd:	ff 75 0c             	pushl  0xc(%ebp)
  8008d0:	01 d8                	add    %ebx,%eax
  8008d2:	50                   	push   %eax
  8008d3:	e8 b8 ff ff ff       	call   800890 <strcpy>
	return dst;
}
  8008d8:	89 d8                	mov    %ebx,%eax
  8008da:	8b 5d fc             	mov    -0x4(%ebp),%ebx
  8008dd:	c9                   	leave  
  8008de:	c3                   	ret    

008008df <strncpy>:

char *
strncpy(char *dst, const char *src, size_t size) {
  8008df:	f3 0f 1e fb          	endbr32 
  8008e3:	55                   	push   %ebp
  8008e4:	89 e5                	mov    %esp,%ebp
  8008e6:	56                   	push   %esi
  8008e7:	53                   	push   %ebx
  8008e8:	8b 75 08             	mov    0x8(%ebp),%esi
  8008eb:	8b 55 0c             	mov    0xc(%ebp),%edx
  8008ee:	89 f3                	mov    %esi,%ebx
  8008f0:	03 5d 10             	add    0x10(%ebp),%ebx
	size_t i;
	char *ret;

	ret = dst;
	for (i = 0; i < size; i++) {
  8008f3:	89 f0                	mov    %esi,%eax
  8008f5:	39 d8                	cmp    %ebx,%eax
  8008f7:	74 11                	je     80090a <strncpy+0x2b>
		*dst++ = *src;
  8008f9:	83 c0 01             	add    $0x1,%eax
  8008fc:	0f b6 0a             	movzbl (%edx),%ecx
  8008ff:	88 48 ff             	mov    %cl,-0x1(%eax)
		// If strlen(src) < size, null-pad 'dst' out to 'size' chars
		if (*src != '\0')
			src++;
  800902:	80 f9 01             	cmp    $0x1,%cl
  800905:	83 da ff             	sbb    $0xffffffff,%edx
  800908:	eb eb                	jmp    8008f5 <strncpy+0x16>
	}
	return ret;
}
  80090a:	89 f0                	mov    %esi,%eax
  80090c:	5b                   	pop    %ebx
  80090d:	5e                   	pop    %esi
  80090e:	5d                   	pop    %ebp
  80090f:	c3                   	ret    

00800910 <strlcpy>:

size_t
strlcpy(char *dst, const char *src, size_t size)
{
  800910:	f3 0f 1e fb          	endbr32 
  800914:	55                   	push   %ebp
  800915:	89 e5                	mov    %esp,%ebp
  800917:	56                   	push   %esi
  800918:	53                   	push   %ebx
  800919:	8b 75 08             	mov    0x8(%ebp),%esi
  80091c:	8b 4d 0c             	mov    0xc(%ebp),%ecx
  80091f:	8b 55 10             	mov    0x10(%ebp),%edx
  800922:	89 f0                	mov    %esi,%eax
	char *dst_in;

	dst_in = dst;
	if (size > 0) {
  800924:	85 d2                	test   %edx,%edx
  800926:	74 21                	je     800949 <strlcpy+0x39>
  800928:	8d 44 16 ff          	lea    -0x1(%esi,%edx,1),%eax
  80092c:	89 f2                	mov    %esi,%edx
		while (--size > 0 && *src != '\0')
  80092e:	39 c2                	cmp    %eax,%edx
  800930:	74 14                	je     800946 <strlcpy+0x36>
  800932:	0f b6 19             	movzbl (%ecx),%ebx
  800935:	84 db                	test   %bl,%bl
  800937:	74 0b                	je     800944 <strlcpy+0x34>
			*dst++ = *src++;
  800939:	83 c1 01             	add    $0x1,%ecx
  80093c:	83 c2 01             	add    $0x1,%edx
  80093f:	88 5a ff             	mov    %bl,-0x1(%edx)
  800942:	eb ea                	jmp    80092e <strlcpy+0x1e>
  800944:	89 d0                	mov    %edx,%eax
		*dst = '\0';
  800946:	c6 00 00             	movb   $0x0,(%eax)
	}
	return dst - dst_in;
  800949:	29 f0                	sub    %esi,%eax
}
  80094b:	5b                   	pop    %ebx
  80094c:	5e                   	pop    %esi
  80094d:	5d                   	pop    %ebp
  80094e:	c3                   	ret    

0080094f <strcmp>:

int
strcmp(const char *p, const char *q)
{
  80094f:	f3 0f 1e fb          	endbr32 
  800953:	55                   	push   %ebp
  800954:	89 e5                	mov    %esp,%ebp
  800956:	8b 4d 08             	mov    0x8(%ebp),%ecx
  800959:	8b 55 0c             	mov    0xc(%ebp),%edx
	while (*p && *p == *q)
  80095c:	0f b6 01             	movzbl (%ecx),%eax
  80095f:	84 c0                	test   %al,%al
  800961:	74 0c                	je     80096f <strcmp+0x20>
  800963:	3a 02                	cmp    (%edx),%al
  800965:	75 08                	jne    80096f <strcmp+0x20>
		p++, q++;
  800967:	83 c1 01             	add    $0x1,%ecx
  80096a:	83 c2 01             	add    $0x1,%edx
  80096d:	eb ed                	jmp    80095c <strcmp+0xd>
	return (int) ((unsigned char) *p - (unsigned char) *q);
  80096f:	0f b6 c0             	movzbl %al,%eax
  800972:	0f b6 12             	movzbl (%edx),%edx
  800975:	29 d0                	sub    %edx,%eax
}
  800977:	5d                   	pop    %ebp
  800978:	c3                   	ret    

00800979 <strncmp>:

int
strncmp(const char *p, const char *q, size_t n)
{
  800979:	f3 0f 1e fb          	endbr32 
  80097d:	55                   	push   %ebp
  80097e:	89 e5                	mov    %esp,%ebp
  800980:	53                   	push   %ebx
  800981:	8b 45 08             	mov    0x8(%ebp),%eax
  800984:	8b 55 0c             	mov    0xc(%ebp),%edx
  800987:	89 c3                	mov    %eax,%ebx
  800989:	03 5d 10             	add    0x10(%ebp),%ebx
	while (n > 0 && *p && *p == *q)
  80098c:	eb 06                	jmp    800994 <strncmp+0x1b>
		n--, p++, q++;
  80098e:	83 c0 01             	add    $0x1,%eax
  800991:	83 c2 01             	add    $0x1,%edx
	while (n > 0 && *p && *p == *q)
  800994:	39 d8                	cmp    %ebx,%eax
  800996:	74 16                	je     8009ae <strncmp+0x35>
  800998:	0f b6 08             	movzbl (%eax),%ecx
  80099b:	84 c9                	test   %cl,%cl
  80099d:	74 04                	je     8009a3 <strncmp+0x2a>
  80099f:	3a 0a                	cmp    (%edx),%cl
  8009a1:	74 eb                	je     80098e <strncmp+0x15>
	if (n == 0)
		return 0;
	else
		return (int) ((unsigned char) *p - (unsigned char) *q);
  8009a3:	0f b6 00             	movzbl (%eax),%eax
  8009a6:	0f b6 12             	movzbl (%edx),%edx
  8009a9:	29 d0                	sub    %edx,%eax
}
  8009ab:	5b                   	pop    %ebx
  8009ac:	5d                   	pop    %ebp
  8009ad:	c3                   	ret    
		return 0;
  8009ae:	b8 00 00 00 00       	mov    $0x0,%eax
  8009b3:	eb f6                	jmp    8009ab <strncmp+0x32>

008009b5 <strchr>:

// Return a pointer to the first occurrence of 'c' in 's',
// or a null pointer if the string has no 'c'.
char *
strchr(const char *s, char c)
{
  8009b5:	f3 0f 1e fb          	endbr32 
  8009b9:	55                   	push   %ebp
  8009ba:	89 e5                	mov    %esp,%ebp
  8009bc:	8b 45 08             	mov    0x8(%ebp),%eax
  8009bf:	0f b6 4d 0c          	movzbl 0xc(%ebp),%ecx
	for (; *s; s++)
  8009c3:	0f b6 10             	movzbl (%eax),%edx
  8009c6:	84 d2                	test   %dl,%dl
  8009c8:	74 09                	je     8009d3 <strchr+0x1e>
		if (*s == c)
  8009ca:	38 ca                	cmp    %cl,%dl
  8009cc:	74 0a                	je     8009d8 <strchr+0x23>
	for (; *s; s++)
  8009ce:	83 c0 01             	add    $0x1,%eax
  8009d1:	eb f0                	jmp    8009c3 <strchr+0xe>
			return (char *) s;
	return 0;
  8009d3:	b8 00 00 00 00       	mov    $0x0,%eax
}
  8009d8:	5d                   	pop    %ebp
  8009d9:	c3                   	ret    

008009da <strfind>:

// Return a pointer to the first occurrence of 'c' in 's',
// or a pointer to the string-ending null character if the string has no 'c'.
char *
strfind(const char *s, char c)
{
  8009da:	f3 0f 1e fb          	endbr32 
  8009de:	55                   	push   %ebp
  8009df:	89 e5                	mov    %esp,%ebp
  8009e1:	8b 45 08             	mov    0x8(%ebp),%eax
  8009e4:	0f b6 4d 0c          	movzbl 0xc(%ebp),%ecx
	for (; *s; s++)
  8009e8:	0f b6 10             	movzbl (%eax),%edx
		if (*s == c)
  8009eb:	38 ca                	cmp    %cl,%dl
  8009ed:	74 09                	je     8009f8 <strfind+0x1e>
  8009ef:	84 d2                	test   %dl,%dl
  8009f1:	74 05                	je     8009f8 <strfind+0x1e>
	for (; *s; s++)
  8009f3:	83 c0 01             	add    $0x1,%eax
  8009f6:	eb f0                	jmp    8009e8 <strfind+0xe>
			break;
	return (char *) s;
}
  8009f8:	5d                   	pop    %ebp
  8009f9:	c3                   	ret    

008009fa <memset>:

#if ASM
void *
memset(void *v, int c, size_t n)
{
  8009fa:	f3 0f 1e fb          	endbr32 
  8009fe:	55                   	push   %ebp
  8009ff:	89 e5                	mov    %esp,%ebp
  800a01:	57                   	push   %edi
  800a02:	56                   	push   %esi
  800a03:	53                   	push   %ebx
  800a04:	8b 7d 08             	mov    0x8(%ebp),%edi
  800a07:	8b 4d 10             	mov    0x10(%ebp),%ecx
	char *p;

	if (n == 0)
  800a0a:	85 c9                	test   %ecx,%ecx
  800a0c:	74 31                	je     800a3f <memset+0x45>
		return v;
	if ((int)v%4 == 0 && n%4 == 0) {
  800a0e:	89 f8                	mov    %edi,%eax
  800a10:	09 c8                	or     %ecx,%eax
  800a12:	a8 03                	test   $0x3,%al
  800a14:	75 23                	jne    800a39 <memset+0x3f>
		c &= 0xFF;
  800a16:	0f b6 55 0c          	movzbl 0xc(%ebp),%edx
		c = (c<<24)|(c<<16)|(c<<8)|c;
  800a1a:	89 d3                	mov    %edx,%ebx
  800a1c:	c1 e3 08             	shl    $0x8,%ebx
  800a1f:	89 d0                	mov    %edx,%eax
  800a21:	c1 e0 18             	shl    $0x18,%eax
  800a24:	89 d6                	mov    %edx,%esi
  800a26:	c1 e6 10             	shl    $0x10,%esi
  800a29:	09 f0                	or     %esi,%eax
  800a2b:	09 c2                	or     %eax,%edx
  800a2d:	09 da                	or     %ebx,%edx
		asm volatile("cld; rep stosl\n"
			:: "D" (v), "a" (c), "c" (n/4)
  800a2f:	c1 e9 02             	shr    $0x2,%ecx
		asm volatile("cld; rep stosl\n"
  800a32:	89 d0                	mov    %edx,%eax
  800a34:	fc                   	cld    
  800a35:	f3 ab                	rep stos %eax,%es:(%edi)
  800a37:	eb 06                	jmp    800a3f <memset+0x45>
			: "cc", "memory");
	} else
		asm volatile("cld; rep stosb\n"
  800a39:	8b 45 0c             	mov    0xc(%ebp),%eax
  800a3c:	fc                   	cld    
  800a3d:	f3 aa                	rep stos %al,%es:(%edi)
			:: "D" (v), "a" (c), "c" (n)
			: "cc", "memory");
	return v;
}
  800a3f:	89 f8                	mov    %edi,%eax
  800a41:	5b                   	pop    %ebx
  800a42:	5e                   	pop    %esi
  800a43:	5f                   	pop    %edi
  800a44:	5d                   	pop    %ebp
  800a45:	c3                   	ret    

00800a46 <memmove>:

void *
memmove(void *dst, const void *src, size_t n)
{
  800a46:	f3 0f 1e fb          	endbr32 
  800a4a:	55                   	push   %ebp
  800a4b:	89 e5                	mov    %esp,%ebp
  800a4d:	57                   	push   %edi
  800a4e:	56                   	push   %esi
  800a4f:	8b 45 08             	mov    0x8(%ebp),%eax
  800a52:	8b 75 0c             	mov    0xc(%ebp),%esi
  800a55:	8b 4d 10             	mov    0x10(%ebp),%ecx
	const char *s;
	char *d;

	s = src;
	d = dst;
	if (s < d && s + n > d) {
  800a58:	39 c6                	cmp    %eax,%esi
  800a5a:	73 32                	jae    800a8e <memmove+0x48>
  800a5c:	8d 14 0e             	lea    (%esi,%ecx,1),%edx
  800a5f:	39 c2                	cmp    %eax,%edx
  800a61:	76 2b                	jbe    800a8e <memmove+0x48>
		s += n;
		d += n;
  800a63:	8d 3c 08             	lea    (%eax,%ecx,1),%edi
		if ((int)s%4 == 0 && (int)d%4 == 0 && n%4 == 0)
  800a66:	89 fe                	mov    %edi,%esi
  800a68:	09 ce                	or     %ecx,%esi
  800a6a:	09 d6                	or     %edx,%esi
  800a6c:	f7 c6 03 00 00 00    	test   $0x3,%esi
  800a72:	75 0e                	jne    800a82 <memmove+0x3c>
			asm volatile("std; rep movsl\n"
				:: "D" (d-4), "S" (s-4), "c" (n/4) : "cc", "memory");
  800a74:	83 ef 04             	sub    $0x4,%edi
  800a77:	8d 72 fc             	lea    -0x4(%edx),%esi
  800a7a:	c1 e9 02             	shr    $0x2,%ecx
			asm volatile("std; rep movsl\n"
  800a7d:	fd                   	std    
  800a7e:	f3 a5                	rep movsl %ds:(%esi),%es:(%edi)
  800a80:	eb 09                	jmp    800a8b <memmove+0x45>
		else
			asm volatile("std; rep movsb\n"
				:: "D" (d-1), "S" (s-1), "c" (n) : "cc", "memory");
  800a82:	83 ef 01             	sub    $0x1,%edi
  800a85:	8d 72 ff             	lea    -0x1(%edx),%esi
			asm volatile("std; rep movsb\n"
  800a88:	fd                   	std    
  800a89:	f3 a4                	rep movsb %ds:(%esi),%es:(%edi)
		// Some versions of GCC rely on DF being clear
		asm volatile("cld" ::: "cc");
  800a8b:	fc                   	cld    
  800a8c:	eb 1a                	jmp    800aa8 <memmove+0x62>
	} else {
		if ((int)s%4 == 0 && (int)d%4 == 0 && n%4 == 0)
  800a8e:	89 c2                	mov    %eax,%edx
  800a90:	09 ca                	or     %ecx,%edx
  800a92:	09 f2                	or     %esi,%edx
  800a94:	f6 c2 03             	test   $0x3,%dl
  800a97:	75 0a                	jne    800aa3 <memmove+0x5d>
			asm volatile("cld; rep movsl\n"
				:: "D" (d), "S" (s), "c" (n/4) : "cc", "memory");
  800a99:	c1 e9 02             	shr    $0x2,%ecx
			asm volatile("cld; rep movsl\n"
  800a9c:	89 c7                	mov    %eax,%edi
  800a9e:	fc                   	cld    
  800a9f:	f3 a5                	rep movsl %ds:(%esi),%es:(%edi)
  800aa1:	eb 05                	jmp    800aa8 <memmove+0x62>
		else
			asm volatile("cld; rep movsb\n"
  800aa3:	89 c7                	mov    %eax,%edi
  800aa5:	fc                   	cld    
  800aa6:	f3 a4                	rep movsb %ds:(%esi),%es:(%edi)
				:: "D" (d), "S" (s), "c" (n) : "cc", "memory");
	}
	return dst;
}
  800aa8:	5e                   	pop    %esi
  800aa9:	5f                   	pop    %edi
  800aaa:	5d                   	pop    %ebp
  800aab:	c3                   	ret    

00800aac <memcpy>:
}
#endif

void *
memcpy(void *dst, const void *src, size_t n)
{
  800aac:	f3 0f 1e fb          	endbr32 
  800ab0:	55                   	push   %ebp
  800ab1:	89 e5                	mov    %esp,%ebp
  800ab3:	83 ec 0c             	sub    $0xc,%esp
	return memmove(dst, src, n);
  800ab6:	ff 75 10             	pushl  0x10(%ebp)
  800ab9:	ff 75 0c             	pushl  0xc(%ebp)
  800abc:	ff 75 08             	pushl  0x8(%ebp)
  800abf:	e8 82 ff ff ff       	call   800a46 <memmove>
}
  800ac4:	c9                   	leave  
  800ac5:	c3                   	ret    

00800ac6 <memcmp>:

int
memcmp(const void *v1, const void *v2, size_t n)
{
  800ac6:	f3 0f 1e fb          	endbr32 
  800aca:	55                   	push   %ebp
  800acb:	89 e5                	mov    %esp,%ebp
  800acd:	56                   	push   %esi
  800ace:	53                   	push   %ebx
  800acf:	8b 45 08             	mov    0x8(%ebp),%eax
  800ad2:	8b 55 0c             	mov    0xc(%ebp),%edx
  800ad5:	89 c6                	mov    %eax,%esi
  800ad7:	03 75 10             	add    0x10(%ebp),%esi
	const uint8_t *s1 = (const uint8_t *) v1;
	const uint8_t *s2 = (const uint8_t *) v2;

	while (n-- > 0) {
  800ada:	39 f0                	cmp    %esi,%eax
  800adc:	74 1c                	je     800afa <memcmp+0x34>
		if (*s1 != *s2)
  800ade:	0f b6 08             	movzbl (%eax),%ecx
  800ae1:	0f b6 1a             	movzbl (%edx),%ebx
  800ae4:	38 d9                	cmp    %bl,%cl
  800ae6:	75 08                	jne    800af0 <memcmp+0x2a>
			return (int) *s1 - (int) *s2;
		s1++, s2++;
  800ae8:	83 c0 01             	add    $0x1,%eax
  800aeb:	83 c2 01             	add    $0x1,%edx
  800aee:	eb ea                	jmp    800ada <memcmp+0x14>
			return (int) *s1 - (int) *s2;
  800af0:	0f b6 c1             	movzbl %cl,%eax
  800af3:	0f b6 db             	movzbl %bl,%ebx
  800af6:	29 d8                	sub    %ebx,%eax
  800af8:	eb 05                	jmp    800aff <memcmp+0x39>
	}

	return 0;
  800afa:	b8 00 00 00 00       	mov    $0x0,%eax
}
  800aff:	5b                   	pop    %ebx
  800b00:	5e                   	pop    %esi
  800b01:	5d                   	pop    %ebp
  800b02:	c3                   	ret    

00800b03 <memfind>:

void *
memfind(const void *s, int c, size_t n)
{
  800b03:	f3 0f 1e fb          	endbr32 
  800b07:	55                   	push   %ebp
  800b08:	89 e5                	mov    %esp,%ebp
  800b0a:	8b 45 08             	mov    0x8(%ebp),%eax
  800b0d:	8b 4d 0c             	mov    0xc(%ebp),%ecx
	const void *ends = (const char *) s + n;
  800b10:	89 c2                	mov    %eax,%edx
  800b12:	03 55 10             	add    0x10(%ebp),%edx
	for (; s < ends; s++)
  800b15:	39 d0                	cmp    %edx,%eax
  800b17:	73 09                	jae    800b22 <memfind+0x1f>
		if (*(const unsigned char *) s == (unsigned char) c)
  800b19:	38 08                	cmp    %cl,(%eax)
  800b1b:	74 05                	je     800b22 <memfind+0x1f>
	for (; s < ends; s++)
  800b1d:	83 c0 01             	add    $0x1,%eax
  800b20:	eb f3                	jmp    800b15 <memfind+0x12>
			break;
	return (void *) s;
}
  800b22:	5d                   	pop    %ebp
  800b23:	c3                   	ret    

00800b24 <strtol>:

long
strtol(const char *s, char **endptr, int base)
{
  800b24:	f3 0f 1e fb          	endbr32 
  800b28:	55                   	push   %ebp
  800b29:	89 e5                	mov    %esp,%ebp
  800b2b:	57                   	push   %edi
  800b2c:	56                   	push   %esi
  800b2d:	53                   	push   %ebx
  800b2e:	8b 4d 08             	mov    0x8(%ebp),%ecx
  800b31:	8b 5d 10             	mov    0x10(%ebp),%ebx
	int neg = 0;
	long val = 0;

	// gobble initial whitespace
	while (*s == ' ' || *s == '\t')
  800b34:	eb 03                	jmp    800b39 <strtol+0x15>
		s++;
  800b36:	83 c1 01             	add    $0x1,%ecx
	while (*s == ' ' || *s == '\t')
  800b39:	0f b6 01             	movzbl (%ecx),%eax
  800b3c:	3c 20                	cmp    $0x20,%al
  800b3e:	74 f6                	je     800b36 <strtol+0x12>
  800b40:	3c 09                	cmp    $0x9,%al
  800b42:	74 f2                	je     800b36 <strtol+0x12>

	// plus/minus sign
	if (*s == '+')
  800b44:	3c 2b                	cmp    $0x2b,%al
  800b46:	74 2a                	je     800b72 <strtol+0x4e>
	int neg = 0;
  800b48:	bf 00 00 00 00       	mov    $0x0,%edi
		s++;
	else if (*s == '-')
  800b4d:	3c 2d                	cmp    $0x2d,%al
  800b4f:	74 2b                	je     800b7c <strtol+0x58>
		s++, neg = 1;

	// hex or octal base prefix
	if ((base == 0 || base == 16) && (s[0] == '0' && s[1] == 'x'))
  800b51:	f7 c3 ef ff ff ff    	test   $0xffffffef,%ebx
  800b57:	75 0f                	jne    800b68 <strtol+0x44>
  800b59:	80 39 30             	cmpb   $0x30,(%ecx)
  800b5c:	74 28                	je     800b86 <strtol+0x62>
		s += 2, base = 16;
	else if (base == 0 && s[0] == '0')
		s++, base = 8;
	else if (base == 0)
		base = 10;
  800b5e:	85 db                	test   %ebx,%ebx
  800b60:	b8 0a 00 00 00       	mov    $0xa,%eax
  800b65:	0f 44 d8             	cmove  %eax,%ebx
  800b68:	b8 00 00 00 00       	mov    $0x0,%eax
  800b6d:	89 5d 10             	mov    %ebx,0x10(%ebp)
  800b70:	eb 46                	jmp    800bb8 <strtol+0x94>
		s++;
  800b72:	83 c1 01             	add    $0x1,%ecx
	int neg = 0;
  800b75:	bf 00 00 00 00       	mov    $0x0,%edi
  800b7a:	eb d5                	jmp    800b51 <strtol+0x2d>
		s++, neg = 1;
  800b7c:	83 c1 01             	add    $0x1,%ecx
  800b7f:	bf 01 00 00 00       	mov    $0x1,%edi
  800b84:	eb cb                	jmp    800b51 <strtol+0x2d>
	if ((base == 0 || base == 16) && (s[0] == '0' && s[1] == 'x'))
  800b86:	80 79 01 78          	cmpb   $0x78,0x1(%ecx)
  800b8a:	74 0e                	je     800b9a <strtol+0x76>
	else if (base == 0 && s[0] == '0')
  800b8c:	85 db                	test   %ebx,%ebx
  800b8e:	75 d8                	jne    800b68 <strtol+0x44>
		s++, base = 8;
  800b90:	83 c1 01             	add    $0x1,%ecx
  800b93:	bb 08 00 00 00       	mov    $0x8,%ebx
  800b98:	eb ce                	jmp    800b68 <strtol+0x44>
		s += 2, base = 16;
  800b9a:	83 c1 02             	add    $0x2,%ecx
  800b9d:	bb 10 00 00 00       	mov    $0x10,%ebx
  800ba2:	eb c4                	jmp    800b68 <strtol+0x44>
	// digits
	while (1) {
		int dig;

		if (*s >= '0' && *s <= '9')
			dig = *s - '0';
  800ba4:	0f be d2             	movsbl %dl,%edx
  800ba7:	83 ea 30             	sub    $0x30,%edx
			dig = *s - 'a' + 10;
		else if (*s >= 'A' && *s <= 'Z')
			dig = *s - 'A' + 10;
		else
			break;
		if (dig >= base)
  800baa:	3b 55 10             	cmp    0x10(%ebp),%edx
  800bad:	7d 3a                	jge    800be9 <strtol+0xc5>
			break;
		s++, val = (val * base) + dig;
  800baf:	83 c1 01             	add    $0x1,%ecx
  800bb2:	0f af 45 10          	imul   0x10(%ebp),%eax
  800bb6:	01 d0                	add    %edx,%eax
		if (*s >= '0' && *s <= '9')
  800bb8:	0f b6 11             	movzbl (%ecx),%edx
  800bbb:	8d 72 d0             	lea    -0x30(%edx),%esi
  800bbe:	89 f3                	mov    %esi,%ebx
  800bc0:	80 fb 09             	cmp    $0x9,%bl
  800bc3:	76 df                	jbe    800ba4 <strtol+0x80>
		else if (*s >= 'a' && *s <= 'z')
  800bc5:	8d 72 9f             	lea    -0x61(%edx),%esi
  800bc8:	89 f3                	mov    %esi,%ebx
  800bca:	80 fb 19             	cmp    $0x19,%bl
  800bcd:	77 08                	ja     800bd7 <strtol+0xb3>
			dig = *s - 'a' + 10;
  800bcf:	0f be d2             	movsbl %dl,%edx
  800bd2:	83 ea 57             	sub    $0x57,%edx
  800bd5:	eb d3                	jmp    800baa <strtol+0x86>
		else if (*s >= 'A' && *s <= 'Z')
  800bd7:	8d 72 bf             	lea    -0x41(%edx),%esi
  800bda:	89 f3                	mov    %esi,%ebx
  800bdc:	80 fb 19             	cmp    $0x19,%bl
  800bdf:	77 08                	ja     800be9 <strtol+0xc5>
			dig = *s - 'A' + 10;
  800be1:	0f be d2             	movsbl %dl,%edx
  800be4:	83 ea 37             	sub    $0x37,%edx
  800be7:	eb c1                	jmp    800baa <strtol+0x86>
		// we don't properly detect overflow!
	}

	if (endptr)
  800be9:	83 7d 0c 00          	cmpl   $0x0,0xc(%ebp)
  800bed:	74 05                	je     800bf4 <strtol+0xd0>
		*endptr = (char *) s;
  800bef:	8b 75 0c             	mov    0xc(%ebp),%esi
  800bf2:	89 0e                	mov    %ecx,(%esi)
	return (neg ? -val : val);
  800bf4:	89 c2                	mov    %eax,%edx
  800bf6:	f7 da                	neg    %edx
  800bf8:	85 ff                	test   %edi,%edi
  800bfa:	0f 45 c2             	cmovne %edx,%eax
}
  800bfd:	5b                   	pop    %ebx
  800bfe:	5e                   	pop    %esi
  800bff:	5f                   	pop    %edi
  800c00:	5d                   	pop    %ebp
  800c01:	c3                   	ret    

00800c02 <sys_cputs>:
	return ret;
}

void
sys_cputs(const char *s, size_t len)
{
  800c02:	f3 0f 1e fb          	endbr32 
  800c06:	55                   	push   %ebp
  800c07:	89 e5                	mov    %esp,%ebp
  800c09:	57                   	push   %edi
  800c0a:	56                   	push   %esi
  800c0b:	53                   	push   %ebx
	asm volatile("int %1\n"
  800c0c:	b8 00 00 00 00       	mov    $0x0,%eax
  800c11:	8b 55 08             	mov    0x8(%ebp),%edx
  800c14:	8b 4d 0c             	mov    0xc(%ebp),%ecx
  800c17:	89 c3                	mov    %eax,%ebx
  800c19:	89 c7                	mov    %eax,%edi
  800c1b:	89 c6                	mov    %eax,%esi
  800c1d:	cd 30                	int    $0x30
	syscall(SYS_cputs, 0, (uint32_t)s, len, 0, 0, 0);
}
  800c1f:	5b                   	pop    %ebx
  800c20:	5e                   	pop    %esi
  800c21:	5f                   	pop    %edi
  800c22:	5d                   	pop    %ebp
  800c23:	c3                   	ret    

00800c24 <sys_cgetc>:

int
sys_cgetc(void)
{
  800c24:	f3 0f 1e fb          	endbr32 
  800c28:	55                   	push   %ebp
  800c29:	89 e5                	mov    %esp,%ebp
  800c2b:	57                   	push   %edi
  800c2c:	56                   	push   %esi
  800c2d:	53                   	push   %ebx
	asm volatile("int %1\n"
  800c2e:	ba 00 00 00 00       	mov    $0x0,%edx
  800c33:	b8 01 00 00 00       	mov    $0x1,%eax
  800c38:	89 d1                	mov    %edx,%ecx
  800c3a:	89 d3                	mov    %edx,%ebx
  800c3c:	89 d7                	mov    %edx,%edi
  800c3e:	89 d6                	mov    %edx,%esi
  800c40:	cd 30                	int    $0x30
	return syscall(SYS_cgetc, 0, 0, 0, 0, 0, 0);
}
  800c42:	5b                   	pop    %ebx
  800c43:	5e                   	pop    %esi
  800c44:	5f                   	pop    %edi
  800c45:	5d                   	pop    %ebp
  800c46:	c3                   	ret    

00800c47 <sys_env_destroy>:

int
sys_env_destroy(envid_t envid)
{
  800c47:	f3 0f 1e fb          	endbr32 
  800c4b:	55                   	push   %ebp
  800c4c:	89 e5                	mov    %esp,%ebp
  800c4e:	57                   	push   %edi
  800c4f:	56                   	push   %esi
  800c50:	53                   	push   %ebx
  800c51:	83 ec 0c             	sub    $0xc,%esp
	asm volatile("int %1\n"
  800c54:	b9 00 00 00 00       	mov    $0x0,%ecx
  800c59:	8b 55 08             	mov    0x8(%ebp),%edx
  800c5c:	b8 03 00 00 00       	mov    $0x3,%eax
  800c61:	89 cb                	mov    %ecx,%ebx
  800c63:	89 cf                	mov    %ecx,%edi
  800c65:	89 ce                	mov    %ecx,%esi
  800c67:	cd 30                	int    $0x30
	if(check && ret > 0)
  800c69:	85 c0                	test   %eax,%eax
  800c6b:	7f 08                	jg     800c75 <sys_env_destroy+0x2e>
	return syscall(SYS_env_destroy, 1, envid, 0, 0, 0, 0);
}
  800c6d:	8d 65 f4             	lea    -0xc(%ebp),%esp
  800c70:	5b                   	pop    %ebx
  800c71:	5e                   	pop    %esi
  800c72:	5f                   	pop    %edi
  800c73:	5d                   	pop    %ebp
  800c74:	c3                   	ret    
		panic("syscall %d returned %d (> 0)", num, ret);
  800c75:	83 ec 0c             	sub    $0xc,%esp
  800c78:	50                   	push   %eax
  800c79:	6a 03                	push   $0x3
  800c7b:	68 bf 27 80 00       	push   $0x8027bf
  800c80:	6a 23                	push   $0x23
  800c82:	68 dc 27 80 00       	push   $0x8027dc
  800c87:	e8 f3 13 00 00       	call   80207f <_panic>

00800c8c <sys_getenvid>:

envid_t
sys_getenvid(void)
{
  800c8c:	f3 0f 1e fb          	endbr32 
  800c90:	55                   	push   %ebp
  800c91:	89 e5                	mov    %esp,%ebp
  800c93:	57                   	push   %edi
  800c94:	56                   	push   %esi
  800c95:	53                   	push   %ebx
	asm volatile("int %1\n"
  800c96:	ba 00 00 00 00       	mov    $0x0,%edx
  800c9b:	b8 02 00 00 00       	mov    $0x2,%eax
  800ca0:	89 d1                	mov    %edx,%ecx
  800ca2:	89 d3                	mov    %edx,%ebx
  800ca4:	89 d7                	mov    %edx,%edi
  800ca6:	89 d6                	mov    %edx,%esi
  800ca8:	cd 30                	int    $0x30
	 return syscall(SYS_getenvid, 0, 0, 0, 0, 0, 0);
}
  800caa:	5b                   	pop    %ebx
  800cab:	5e                   	pop    %esi
  800cac:	5f                   	pop    %edi
  800cad:	5d                   	pop    %ebp
  800cae:	c3                   	ret    

00800caf <sys_yield>:

void
sys_yield(void)
{
  800caf:	f3 0f 1e fb          	endbr32 
  800cb3:	55                   	push   %ebp
  800cb4:	89 e5                	mov    %esp,%ebp
  800cb6:	57                   	push   %edi
  800cb7:	56                   	push   %esi
  800cb8:	53                   	push   %ebx
	asm volatile("int %1\n"
  800cb9:	ba 00 00 00 00       	mov    $0x0,%edx
  800cbe:	b8 0b 00 00 00       	mov    $0xb,%eax
  800cc3:	89 d1                	mov    %edx,%ecx
  800cc5:	89 d3                	mov    %edx,%ebx
  800cc7:	89 d7                	mov    %edx,%edi
  800cc9:	89 d6                	mov    %edx,%esi
  800ccb:	cd 30                	int    $0x30
	syscall(SYS_yield, 0, 0, 0, 0, 0, 0);
}
  800ccd:	5b                   	pop    %ebx
  800cce:	5e                   	pop    %esi
  800ccf:	5f                   	pop    %edi
  800cd0:	5d                   	pop    %ebp
  800cd1:	c3                   	ret    

00800cd2 <sys_page_alloc>:

int
sys_page_alloc(envid_t envid, void *va, int perm)
{
  800cd2:	f3 0f 1e fb          	endbr32 
  800cd6:	55                   	push   %ebp
  800cd7:	89 e5                	mov    %esp,%ebp
  800cd9:	57                   	push   %edi
  800cda:	56                   	push   %esi
  800cdb:	53                   	push   %ebx
  800cdc:	83 ec 0c             	sub    $0xc,%esp
	asm volatile("int %1\n"
  800cdf:	be 00 00 00 00       	mov    $0x0,%esi
  800ce4:	8b 55 08             	mov    0x8(%ebp),%edx
  800ce7:	8b 4d 0c             	mov    0xc(%ebp),%ecx
  800cea:	b8 04 00 00 00       	mov    $0x4,%eax
  800cef:	8b 5d 10             	mov    0x10(%ebp),%ebx
  800cf2:	89 f7                	mov    %esi,%edi
  800cf4:	cd 30                	int    $0x30
	if(check && ret > 0)
  800cf6:	85 c0                	test   %eax,%eax
  800cf8:	7f 08                	jg     800d02 <sys_page_alloc+0x30>
	return syscall(SYS_page_alloc, 1, envid, (uint32_t) va, perm, 0, 0);
}
  800cfa:	8d 65 f4             	lea    -0xc(%ebp),%esp
  800cfd:	5b                   	pop    %ebx
  800cfe:	5e                   	pop    %esi
  800cff:	5f                   	pop    %edi
  800d00:	5d                   	pop    %ebp
  800d01:	c3                   	ret    
		panic("syscall %d returned %d (> 0)", num, ret);
  800d02:	83 ec 0c             	sub    $0xc,%esp
  800d05:	50                   	push   %eax
  800d06:	6a 04                	push   $0x4
  800d08:	68 bf 27 80 00       	push   $0x8027bf
  800d0d:	6a 23                	push   $0x23
  800d0f:	68 dc 27 80 00       	push   $0x8027dc
  800d14:	e8 66 13 00 00       	call   80207f <_panic>

00800d19 <sys_page_map>:

int
sys_page_map(envid_t srcenv, void *srcva, envid_t dstenv, void *dstva, int perm)
{
  800d19:	f3 0f 1e fb          	endbr32 
  800d1d:	55                   	push   %ebp
  800d1e:	89 e5                	mov    %esp,%ebp
  800d20:	57                   	push   %edi
  800d21:	56                   	push   %esi
  800d22:	53                   	push   %ebx
  800d23:	83 ec 0c             	sub    $0xc,%esp
	asm volatile("int %1\n"
  800d26:	8b 55 08             	mov    0x8(%ebp),%edx
  800d29:	8b 4d 0c             	mov    0xc(%ebp),%ecx
  800d2c:	b8 05 00 00 00       	mov    $0x5,%eax
  800d31:	8b 5d 10             	mov    0x10(%ebp),%ebx
  800d34:	8b 7d 14             	mov    0x14(%ebp),%edi
  800d37:	8b 75 18             	mov    0x18(%ebp),%esi
  800d3a:	cd 30                	int    $0x30
	if(check && ret > 0)
  800d3c:	85 c0                	test   %eax,%eax
  800d3e:	7f 08                	jg     800d48 <sys_page_map+0x2f>
	return syscall(SYS_page_map, 1, srcenv, (uint32_t) srcva, dstenv, (uint32_t) dstva, perm);
}
  800d40:	8d 65 f4             	lea    -0xc(%ebp),%esp
  800d43:	5b                   	pop    %ebx
  800d44:	5e                   	pop    %esi
  800d45:	5f                   	pop    %edi
  800d46:	5d                   	pop    %ebp
  800d47:	c3                   	ret    
		panic("syscall %d returned %d (> 0)", num, ret);
  800d48:	83 ec 0c             	sub    $0xc,%esp
  800d4b:	50                   	push   %eax
  800d4c:	6a 05                	push   $0x5
  800d4e:	68 bf 27 80 00       	push   $0x8027bf
  800d53:	6a 23                	push   $0x23
  800d55:	68 dc 27 80 00       	push   $0x8027dc
  800d5a:	e8 20 13 00 00       	call   80207f <_panic>

00800d5f <sys_page_unmap>:

int
sys_page_unmap(envid_t envid, void *va)
{
  800d5f:	f3 0f 1e fb          	endbr32 
  800d63:	55                   	push   %ebp
  800d64:	89 e5                	mov    %esp,%ebp
  800d66:	57                   	push   %edi
  800d67:	56                   	push   %esi
  800d68:	53                   	push   %ebx
  800d69:	83 ec 0c             	sub    $0xc,%esp
	asm volatile("int %1\n"
  800d6c:	bb 00 00 00 00       	mov    $0x0,%ebx
  800d71:	8b 55 08             	mov    0x8(%ebp),%edx
  800d74:	8b 4d 0c             	mov    0xc(%ebp),%ecx
  800d77:	b8 06 00 00 00       	mov    $0x6,%eax
  800d7c:	89 df                	mov    %ebx,%edi
  800d7e:	89 de                	mov    %ebx,%esi
  800d80:	cd 30                	int    $0x30
	if(check && ret > 0)
  800d82:	85 c0                	test   %eax,%eax
  800d84:	7f 08                	jg     800d8e <sys_page_unmap+0x2f>
	return syscall(SYS_page_unmap, 1, envid, (uint32_t) va, 0, 0, 0);
}
  800d86:	8d 65 f4             	lea    -0xc(%ebp),%esp
  800d89:	5b                   	pop    %ebx
  800d8a:	5e                   	pop    %esi
  800d8b:	5f                   	pop    %edi
  800d8c:	5d                   	pop    %ebp
  800d8d:	c3                   	ret    
		panic("syscall %d returned %d (> 0)", num, ret);
  800d8e:	83 ec 0c             	sub    $0xc,%esp
  800d91:	50                   	push   %eax
  800d92:	6a 06                	push   $0x6
  800d94:	68 bf 27 80 00       	push   $0x8027bf
  800d99:	6a 23                	push   $0x23
  800d9b:	68 dc 27 80 00       	push   $0x8027dc
  800da0:	e8 da 12 00 00       	call   80207f <_panic>

00800da5 <sys_env_set_status>:

// sys_exofork is inlined in lib.h

int
sys_env_set_status(envid_t envid, int status)
{
  800da5:	f3 0f 1e fb          	endbr32 
  800da9:	55                   	push   %ebp
  800daa:	89 e5                	mov    %esp,%ebp
  800dac:	57                   	push   %edi
  800dad:	56                   	push   %esi
  800dae:	53                   	push   %ebx
  800daf:	83 ec 0c             	sub    $0xc,%esp
	asm volatile("int %1\n"
  800db2:	bb 00 00 00 00       	mov    $0x0,%ebx
  800db7:	8b 55 08             	mov    0x8(%ebp),%edx
  800dba:	8b 4d 0c             	mov    0xc(%ebp),%ecx
  800dbd:	b8 08 00 00 00       	mov    $0x8,%eax
  800dc2:	89 df                	mov    %ebx,%edi
  800dc4:	89 de                	mov    %ebx,%esi
  800dc6:	cd 30                	int    $0x30
	if(check && ret > 0)
  800dc8:	85 c0                	test   %eax,%eax
  800dca:	7f 08                	jg     800dd4 <sys_env_set_status+0x2f>
	return syscall(SYS_env_set_status, 1, envid, status, 0, 0, 0);
}
  800dcc:	8d 65 f4             	lea    -0xc(%ebp),%esp
  800dcf:	5b                   	pop    %ebx
  800dd0:	5e                   	pop    %esi
  800dd1:	5f                   	pop    %edi
  800dd2:	5d                   	pop    %ebp
  800dd3:	c3                   	ret    
		panic("syscall %d returned %d (> 0)", num, ret);
  800dd4:	83 ec 0c             	sub    $0xc,%esp
  800dd7:	50                   	push   %eax
  800dd8:	6a 08                	push   $0x8
  800dda:	68 bf 27 80 00       	push   $0x8027bf
  800ddf:	6a 23                	push   $0x23
  800de1:	68 dc 27 80 00       	push   $0x8027dc
  800de6:	e8 94 12 00 00       	call   80207f <_panic>

00800deb <sys_env_set_trapframe>:

int
sys_env_set_trapframe(envid_t envid, struct Trapframe *tf)
{
  800deb:	f3 0f 1e fb          	endbr32 
  800def:	55                   	push   %ebp
  800df0:	89 e5                	mov    %esp,%ebp
  800df2:	57                   	push   %edi
  800df3:	56                   	push   %esi
  800df4:	53                   	push   %ebx
  800df5:	83 ec 0c             	sub    $0xc,%esp
	asm volatile("int %1\n"
  800df8:	bb 00 00 00 00       	mov    $0x0,%ebx
  800dfd:	8b 55 08             	mov    0x8(%ebp),%edx
  800e00:	8b 4d 0c             	mov    0xc(%ebp),%ecx
  800e03:	b8 09 00 00 00       	mov    $0x9,%eax
  800e08:	89 df                	mov    %ebx,%edi
  800e0a:	89 de                	mov    %ebx,%esi
  800e0c:	cd 30                	int    $0x30
	if(check && ret > 0)
  800e0e:	85 c0                	test   %eax,%eax
  800e10:	7f 08                	jg     800e1a <sys_env_set_trapframe+0x2f>
	return syscall(SYS_env_set_trapframe, 1, envid, (uint32_t) tf, 0, 0, 0);
}
  800e12:	8d 65 f4             	lea    -0xc(%ebp),%esp
  800e15:	5b                   	pop    %ebx
  800e16:	5e                   	pop    %esi
  800e17:	5f                   	pop    %edi
  800e18:	5d                   	pop    %ebp
  800e19:	c3                   	ret    
		panic("syscall %d returned %d (> 0)", num, ret);
  800e1a:	83 ec 0c             	sub    $0xc,%esp
  800e1d:	50                   	push   %eax
  800e1e:	6a 09                	push   $0x9
  800e20:	68 bf 27 80 00       	push   $0x8027bf
  800e25:	6a 23                	push   $0x23
  800e27:	68 dc 27 80 00       	push   $0x8027dc
  800e2c:	e8 4e 12 00 00       	call   80207f <_panic>

00800e31 <sys_env_set_pgfault_upcall>:

int
sys_env_set_pgfault_upcall(envid_t envid, void *upcall)
{
  800e31:	f3 0f 1e fb          	endbr32 
  800e35:	55                   	push   %ebp
  800e36:	89 e5                	mov    %esp,%ebp
  800e38:	57                   	push   %edi
  800e39:	56                   	push   %esi
  800e3a:	53                   	push   %ebx
  800e3b:	83 ec 0c             	sub    $0xc,%esp
	asm volatile("int %1\n"
  800e3e:	bb 00 00 00 00       	mov    $0x0,%ebx
  800e43:	8b 55 08             	mov    0x8(%ebp),%edx
  800e46:	8b 4d 0c             	mov    0xc(%ebp),%ecx
  800e49:	b8 0a 00 00 00       	mov    $0xa,%eax
  800e4e:	89 df                	mov    %ebx,%edi
  800e50:	89 de                	mov    %ebx,%esi
  800e52:	cd 30                	int    $0x30
	if(check && ret > 0)
  800e54:	85 c0                	test   %eax,%eax
  800e56:	7f 08                	jg     800e60 <sys_env_set_pgfault_upcall+0x2f>
	return syscall(SYS_env_set_pgfault_upcall, 1, envid, (uint32_t) upcall, 0, 0, 0);
}
  800e58:	8d 65 f4             	lea    -0xc(%ebp),%esp
  800e5b:	5b                   	pop    %ebx
  800e5c:	5e                   	pop    %esi
  800e5d:	5f                   	pop    %edi
  800e5e:	5d                   	pop    %ebp
  800e5f:	c3                   	ret    
		panic("syscall %d returned %d (> 0)", num, ret);
  800e60:	83 ec 0c             	sub    $0xc,%esp
  800e63:	50                   	push   %eax
  800e64:	6a 0a                	push   $0xa
  800e66:	68 bf 27 80 00       	push   $0x8027bf
  800e6b:	6a 23                	push   $0x23
  800e6d:	68 dc 27 80 00       	push   $0x8027dc
  800e72:	e8 08 12 00 00       	call   80207f <_panic>

00800e77 <sys_ipc_try_send>:

int
sys_ipc_try_send(envid_t envid, uint32_t value, void *srcva, int perm)
{
  800e77:	f3 0f 1e fb          	endbr32 
  800e7b:	55                   	push   %ebp
  800e7c:	89 e5                	mov    %esp,%ebp
  800e7e:	57                   	push   %edi
  800e7f:	56                   	push   %esi
  800e80:	53                   	push   %ebx
	asm volatile("int %1\n"
  800e81:	8b 55 08             	mov    0x8(%ebp),%edx
  800e84:	8b 4d 0c             	mov    0xc(%ebp),%ecx
  800e87:	b8 0c 00 00 00       	mov    $0xc,%eax
  800e8c:	be 00 00 00 00       	mov    $0x0,%esi
  800e91:	8b 5d 10             	mov    0x10(%ebp),%ebx
  800e94:	8b 7d 14             	mov    0x14(%ebp),%edi
  800e97:	cd 30                	int    $0x30
	return syscall(SYS_ipc_try_send, 0, envid, value, (uint32_t) srcva, perm, 0);
}
  800e99:	5b                   	pop    %ebx
  800e9a:	5e                   	pop    %esi
  800e9b:	5f                   	pop    %edi
  800e9c:	5d                   	pop    %ebp
  800e9d:	c3                   	ret    

00800e9e <sys_ipc_recv>:

int
sys_ipc_recv(void *dstva)
{
  800e9e:	f3 0f 1e fb          	endbr32 
  800ea2:	55                   	push   %ebp
  800ea3:	89 e5                	mov    %esp,%ebp
  800ea5:	57                   	push   %edi
  800ea6:	56                   	push   %esi
  800ea7:	53                   	push   %ebx
  800ea8:	83 ec 0c             	sub    $0xc,%esp
	asm volatile("int %1\n"
  800eab:	b9 00 00 00 00       	mov    $0x0,%ecx
  800eb0:	8b 55 08             	mov    0x8(%ebp),%edx
  800eb3:	b8 0d 00 00 00       	mov    $0xd,%eax
  800eb8:	89 cb                	mov    %ecx,%ebx
  800eba:	89 cf                	mov    %ecx,%edi
  800ebc:	89 ce                	mov    %ecx,%esi
  800ebe:	cd 30                	int    $0x30
	if(check && ret > 0)
  800ec0:	85 c0                	test   %eax,%eax
  800ec2:	7f 08                	jg     800ecc <sys_ipc_recv+0x2e>
	return syscall(SYS_ipc_recv, 1, (uint32_t)dstva, 0, 0, 0, 0);
}
  800ec4:	8d 65 f4             	lea    -0xc(%ebp),%esp
  800ec7:	5b                   	pop    %ebx
  800ec8:	5e                   	pop    %esi
  800ec9:	5f                   	pop    %edi
  800eca:	5d                   	pop    %ebp
  800ecb:	c3                   	ret    
		panic("syscall %d returned %d (> 0)", num, ret);
  800ecc:	83 ec 0c             	sub    $0xc,%esp
  800ecf:	50                   	push   %eax
  800ed0:	6a 0d                	push   $0xd
  800ed2:	68 bf 27 80 00       	push   $0x8027bf
  800ed7:	6a 23                	push   $0x23
  800ed9:	68 dc 27 80 00       	push   $0x8027dc
  800ede:	e8 9c 11 00 00       	call   80207f <_panic>

00800ee3 <pgfault>:
// Custom page fault handler - if faulting page is copy-on-write,
// map in our own private writable copy.
//
static void
pgfault(struct UTrapframe *utf)
{
  800ee3:	f3 0f 1e fb          	endbr32 
  800ee7:	55                   	push   %ebp
  800ee8:	89 e5                	mov    %esp,%ebp
  800eea:	56                   	push   %esi
  800eeb:	53                   	push   %ebx
  800eec:	8b 45 08             	mov    0x8(%ebp),%eax
	void *addr = (void *) utf->utf_fault_va;
  800eef:	8b 18                	mov    (%eax),%ebx
	/*
	将父进程空间中所有可以写的页表的部分全部标记为可读且COW【因此读取的时候不会进入pgfault，但是写的时候会触发pgfault】。
	而当父进程或者子进程任意一个发生了写的时候，因为页表现在都是不可写的，所以会触发异常，进入到我们设定的page fault处理例程，
	当检测到是对COW页的写操作的情况下，就可以将要写入的页的内容全部拷贝一份，重新映射。
	*/
    if (!((err & FEC_WR) && (uvpd[PDX(addr)] & PTE_P) && 
  800ef1:	f6 40 04 02          	testb  $0x2,0x4(%eax)
  800ef5:	0f 84 b2 00 00 00    	je     800fad <pgfault+0xca>
  800efb:	89 d8                	mov    %ebx,%eax
  800efd:	c1 e8 16             	shr    $0x16,%eax
  800f00:	8b 04 85 00 d0 7b ef 	mov    -0x10843000(,%eax,4),%eax
  800f07:	a8 01                	test   $0x1,%al
  800f09:	0f 84 9e 00 00 00    	je     800fad <pgfault+0xca>
			(uvpt[PGNUM(addr)] & PTE_P) && (uvpt[PGNUM(addr)] & PTE_COW)))
  800f0f:	89 d8                	mov    %ebx,%eax
  800f11:	c1 e8 0c             	shr    $0xc,%eax
  800f14:	8b 14 85 00 00 40 ef 	mov    -0x10c00000(,%eax,4),%edx
    if (!((err & FEC_WR) && (uvpd[PDX(addr)] & PTE_P) && 
  800f1b:	f6 c2 01             	test   $0x1,%dl
  800f1e:	0f 84 89 00 00 00    	je     800fad <pgfault+0xca>
			(uvpt[PGNUM(addr)] & PTE_P) && (uvpt[PGNUM(addr)] & PTE_COW)))
  800f24:	8b 04 85 00 00 40 ef 	mov    -0x10c00000(,%eax,4),%eax
    if (!((err & FEC_WR) && (uvpd[PDX(addr)] & PTE_P) && 
  800f2b:	f6 c4 08             	test   $0x8,%ah
  800f2e:	74 7d                	je     800fad <pgfault+0xca>
                panic("pgfault: it's not writable or attempt to access a non-cow page!");
	//为该进程分配新的页面。
	envid_t envid=sys_getenvid();
  800f30:	e8 57 fd ff ff       	call   800c8c <sys_getenvid>
  800f35:	89 c6                	mov    %eax,%esi
	r=sys_page_alloc(envid,(void*)PFTEMP,PTE_P|PTE_U|PTE_W);
  800f37:	83 ec 04             	sub    $0x4,%esp
  800f3a:	6a 07                	push   $0x7
  800f3c:	68 00 f0 7f 00       	push   $0x7ff000
  800f41:	50                   	push   %eax
  800f42:	e8 8b fd ff ff       	call   800cd2 <sys_page_alloc>
	if(r<0){
  800f47:	83 c4 10             	add    $0x10,%esp
  800f4a:	85 c0                	test   %eax,%eax
  800f4c:	78 73                	js     800fc1 <pgfault+0xde>
		 panic("pgfault: page allocation failed %e", r);
	}
	//解开了我的疑惑，为什么随着fork页空间会逐渐发生偏移。
	//迁移数据过去。
	addr=ROUNDDOWN(addr,PGSIZE);
  800f4e:	81 e3 00 f0 ff ff    	and    $0xfffff000,%ebx
	//拷贝内容。
	memmove(PFTEMP,addr,PGSIZE);
  800f54:	83 ec 04             	sub    $0x4,%esp
  800f57:	68 00 10 00 00       	push   $0x1000
  800f5c:	53                   	push   %ebx
  800f5d:	68 00 f0 7f 00       	push   $0x7ff000
  800f62:	e8 df fa ff ff       	call   800a46 <memmove>
	//解除和addr的映射关系。
	r=sys_page_unmap(envid,(void*)addr);
  800f67:	83 c4 08             	add    $0x8,%esp
  800f6a:	53                   	push   %ebx
  800f6b:	56                   	push   %esi
  800f6c:	e8 ee fd ff ff       	call   800d5f <sys_page_unmap>
	if(r<0)
  800f71:	83 c4 10             	add    $0x10,%esp
  800f74:	85 c0                	test   %eax,%eax
  800f76:	78 5b                	js     800fd3 <pgfault+0xf0>
	panic("pgfault: page unmap failed %e", r);
	r=sys_page_map(envid,PFTEMP,envid,addr,PTE_P|PTE_U|PTE_W);
  800f78:	83 ec 0c             	sub    $0xc,%esp
  800f7b:	6a 07                	push   $0x7
  800f7d:	53                   	push   %ebx
  800f7e:	56                   	push   %esi
  800f7f:	68 00 f0 7f 00       	push   $0x7ff000
  800f84:	56                   	push   %esi
  800f85:	e8 8f fd ff ff       	call   800d19 <sys_page_map>
	if(r<0)
  800f8a:	83 c4 20             	add    $0x20,%esp
  800f8d:	85 c0                	test   %eax,%eax
  800f8f:	78 54                	js     800fe5 <pgfault+0x102>
	panic("pgfault: page map failed %e", r);
	r=sys_page_unmap(envid,PFTEMP);
  800f91:	83 ec 08             	sub    $0x8,%esp
  800f94:	68 00 f0 7f 00       	push   $0x7ff000
  800f99:	56                   	push   %esi
  800f9a:	e8 c0 fd ff ff       	call   800d5f <sys_page_unmap>
	if(r<0)
  800f9f:	83 c4 10             	add    $0x10,%esp
  800fa2:	85 c0                	test   %eax,%eax
  800fa4:	78 51                	js     800ff7 <pgfault+0x114>
	panic("pgfault: page unmap failed %e", r);
}
  800fa6:	8d 65 f8             	lea    -0x8(%ebp),%esp
  800fa9:	5b                   	pop    %ebx
  800faa:	5e                   	pop    %esi
  800fab:	5d                   	pop    %ebp
  800fac:	c3                   	ret    
                panic("pgfault: it's not writable or attempt to access a non-cow page!");
  800fad:	83 ec 04             	sub    $0x4,%esp
  800fb0:	68 ec 27 80 00       	push   $0x8027ec
  800fb5:	6a 2c                	push   $0x2c
  800fb7:	68 9b 28 80 00       	push   $0x80289b
  800fbc:	e8 be 10 00 00       	call   80207f <_panic>
		 panic("pgfault: page allocation failed %e", r);
  800fc1:	50                   	push   %eax
  800fc2:	68 2c 28 80 00       	push   $0x80282c
  800fc7:	6a 31                	push   $0x31
  800fc9:	68 9b 28 80 00       	push   $0x80289b
  800fce:	e8 ac 10 00 00       	call   80207f <_panic>
	panic("pgfault: page unmap failed %e", r);
  800fd3:	50                   	push   %eax
  800fd4:	68 a6 28 80 00       	push   $0x8028a6
  800fd9:	6a 3b                	push   $0x3b
  800fdb:	68 9b 28 80 00       	push   $0x80289b
  800fe0:	e8 9a 10 00 00       	call   80207f <_panic>
	panic("pgfault: page map failed %e", r);
  800fe5:	50                   	push   %eax
  800fe6:	68 c4 28 80 00       	push   $0x8028c4
  800feb:	6a 3e                	push   $0x3e
  800fed:	68 9b 28 80 00       	push   $0x80289b
  800ff2:	e8 88 10 00 00       	call   80207f <_panic>
	panic("pgfault: page unmap failed %e", r);
  800ff7:	50                   	push   %eax
  800ff8:	68 a6 28 80 00       	push   $0x8028a6
  800ffd:	6a 41                	push   $0x41
  800fff:	68 9b 28 80 00       	push   $0x80289b
  801004:	e8 76 10 00 00       	call   80207f <_panic>

00801009 <fork>:
//   Neither user exception stack should ever be marked copy-on-write,
//   so you must allocate a new page for the child's user exception stack.
//
envid_t
fork(void)
{
  801009:	f3 0f 1e fb          	endbr32 
  80100d:	55                   	push   %ebp
  80100e:	89 e5                	mov    %esp,%ebp
  801010:	57                   	push   %edi
  801011:	56                   	push   %esi
  801012:	53                   	push   %ebx
  801013:	83 ec 28             	sub    $0x28,%esp
	// LAB 4: Your code here.
	envid_t envid;
	uintptr_t pageVa;
	unsigned pn;
	//设置pgfault情况下对应处理的函数。
	set_pgfault_handler(pgfault);
  801016:	68 e3 0e 80 00       	push   $0x800ee3
  80101b:	e8 a9 10 00 00       	call   8020c9 <set_pgfault_handler>
// This must be inlined.  Exercise for reader: why?
static inline envid_t __attribute__((always_inline))
sys_exofork(void)
{
	envid_t ret;
	asm volatile("int %2"
  801020:	b8 07 00 00 00       	mov    $0x7,%eax
  801025:	cd 30                	int    $0x30
  801027:	89 c7                	mov    %eax,%edi
  801029:	89 45 e4             	mov    %eax,-0x1c(%ebp)
	//首先需要分配一个env，env_alloc是内核态调用的，因此只能去调系统调用对应的函数来请求分配一个环境描述符。
	envid=sys_exofork();
	//分配成功
	if(envid>0){
  80102c:	83 c4 10             	add    $0x10,%esp
  80102f:	85 c0                	test   %eax,%eax
  801031:	0f 8e 9d 01 00 00    	jle    8011d4 <fork+0x1cb>
		//接下来应该要拷贝父进程。当然这里让我吃惊的是直接可以调用对应的宏并且并没有去请求父进程。jos系统似乎是把所有的子进程都来源于同一进程，而不是父子继承关系。
		for(pageVa=UTEXT;pageVa<USTACKTOP;pageVa+=PGSIZE){
  801037:	bb 00 00 80 00       	mov    $0x800000,%ebx
  80103c:	eb 5b                	jmp    801099 <fork+0x90>
			sys_page_map(0, addr, envid, addr, PTE_SYSCALL);
  80103e:	83 ec 0c             	sub    $0xc,%esp
  801041:	68 07 0e 00 00       	push   $0xe07
  801046:	56                   	push   %esi
  801047:	ff 75 e4             	pushl  -0x1c(%ebp)
  80104a:	56                   	push   %esi
  80104b:	6a 00                	push   $0x0
  80104d:	e8 c7 fc ff ff       	call   800d19 <sys_page_map>
  801052:	83 c4 20             	add    $0x20,%esp
  801055:	eb 30                	jmp    801087 <fork+0x7e>
                panic("duppage: sys_page_map fail\n");
  801057:	83 ec 04             	sub    $0x4,%esp
  80105a:	68 e0 28 80 00       	push   $0x8028e0
  80105f:	6a 63                	push   $0x63
  801061:	68 9b 28 80 00       	push   $0x80289b
  801066:	e8 14 10 00 00       	call   80207f <_panic>
            r = sys_page_map(0, addr, envid, addr, PTE_U | PTE_P);
  80106b:	83 ec 0c             	sub    $0xc,%esp
  80106e:	6a 05                	push   $0x5
  801070:	56                   	push   %esi
  801071:	ff 75 e4             	pushl  -0x1c(%ebp)
  801074:	56                   	push   %esi
  801075:	6a 00                	push   $0x0
  801077:	e8 9d fc ff ff       	call   800d19 <sys_page_map>
            if(r < 0)
  80107c:	83 c4 20             	add    $0x20,%esp
  80107f:	85 c0                	test   %eax,%eax
  801081:	0f 88 ac 00 00 00    	js     801133 <fork+0x12a>
		for(pageVa=UTEXT;pageVa<USTACKTOP;pageVa+=PGSIZE){
  801087:	81 c3 00 10 00 00    	add    $0x1000,%ebx
  80108d:	81 fb 00 e0 bf ee    	cmp    $0xeebfe000,%ebx
  801093:	0f 84 ae 00 00 00    	je     801147 <fork+0x13e>
			pn=PGNUM(pageVa);
			//检查权限，挨个copy页
			if((uvpd[PDX(pageVa)]&PTE_P)&&(uvpt[pn]&PTE_P)&&(uvpt[pn]&PTE_U)){
  801099:	89 d8                	mov    %ebx,%eax
  80109b:	c1 e8 16             	shr    $0x16,%eax
  80109e:	8b 04 85 00 d0 7b ef 	mov    -0x10843000(,%eax,4),%eax
  8010a5:	a8 01                	test   $0x1,%al
  8010a7:	74 de                	je     801087 <fork+0x7e>
			pn=PGNUM(pageVa);
  8010a9:	89 d8                	mov    %ebx,%eax
  8010ab:	c1 e8 0c             	shr    $0xc,%eax
			if((uvpd[PDX(pageVa)]&PTE_P)&&(uvpt[pn]&PTE_P)&&(uvpt[pn]&PTE_U)){
  8010ae:	8b 14 85 00 00 40 ef 	mov    -0x10c00000(,%eax,4),%edx
  8010b5:	f6 c2 01             	test   $0x1,%dl
  8010b8:	74 cd                	je     801087 <fork+0x7e>
  8010ba:	8b 14 85 00 00 40 ef 	mov    -0x10c00000(,%eax,4),%edx
  8010c1:	f6 c2 04             	test   $0x4,%dl
  8010c4:	74 c1                	je     801087 <fork+0x7e>
        addr = (void *)((uint32_t)pn * PGSIZE);
  8010c6:	89 c6                	mov    %eax,%esi
  8010c8:	c1 e6 0c             	shl    $0xc,%esi
        pte = uvpt[pn];
  8010cb:	8b 04 85 00 00 40 ef 	mov    -0x10c00000(,%eax,4),%eax
		if(pte&PTE_SHARE){
  8010d2:	f6 c4 04             	test   $0x4,%ah
  8010d5:	0f 85 63 ff ff ff    	jne    80103e <fork+0x35>
        else if((pte & PTE_COW) || (pte & PTE_W))
  8010db:	a9 02 08 00 00       	test   $0x802,%eax
  8010e0:	74 89                	je     80106b <fork+0x62>
            r = sys_page_map(0, addr, envid, addr, PTE_COW | PTE_U | PTE_P);
  8010e2:	83 ec 0c             	sub    $0xc,%esp
  8010e5:	68 05 08 00 00       	push   $0x805
  8010ea:	56                   	push   %esi
  8010eb:	ff 75 e4             	pushl  -0x1c(%ebp)
  8010ee:	56                   	push   %esi
  8010ef:	6a 00                	push   $0x0
  8010f1:	e8 23 fc ff ff       	call   800d19 <sys_page_map>
            if(r < 0)
  8010f6:	83 c4 20             	add    $0x20,%esp
  8010f9:	85 c0                	test   %eax,%eax
  8010fb:	0f 88 56 ff ff ff    	js     801057 <fork+0x4e>
            r = sys_page_map(0, addr, 0, addr, PTE_COW | PTE_U | PTE_P);
  801101:	83 ec 0c             	sub    $0xc,%esp
  801104:	68 05 08 00 00       	push   $0x805
  801109:	56                   	push   %esi
  80110a:	6a 00                	push   $0x0
  80110c:	56                   	push   %esi
  80110d:	6a 00                	push   $0x0
  80110f:	e8 05 fc ff ff       	call   800d19 <sys_page_map>
            if(r < 0)
  801114:	83 c4 20             	add    $0x20,%esp
  801117:	85 c0                	test   %eax,%eax
  801119:	0f 89 68 ff ff ff    	jns    801087 <fork+0x7e>
                panic("duppage: sys_page_map fail\n");
  80111f:	83 ec 04             	sub    $0x4,%esp
  801122:	68 e0 28 80 00       	push   $0x8028e0
  801127:	6a 66                	push   $0x66
  801129:	68 9b 28 80 00       	push   $0x80289b
  80112e:	e8 4c 0f 00 00       	call   80207f <_panic>
                panic("duppage: sys_page_map fail\n");
  801133:	83 ec 04             	sub    $0x4,%esp
  801136:	68 e0 28 80 00       	push   $0x8028e0
  80113b:	6a 6c                	push   $0x6c
  80113d:	68 9b 28 80 00       	push   $0x80289b
  801142:	e8 38 0f 00 00       	call   80207f <_panic>
				duppage(envid,pn);}
			}
		//分配异常栈。
		int32_t flag=sys_page_alloc(envid,(void*)(UXSTACKTOP-PGSIZE),PTE_P|PTE_U|PTE_W);
  801147:	83 ec 04             	sub    $0x4,%esp
  80114a:	6a 07                	push   $0x7
  80114c:	68 00 f0 bf ee       	push   $0xeebff000
  801151:	57                   	push   %edi
  801152:	e8 7b fb ff ff       	call   800cd2 <sys_page_alloc>
		if(flag<0){
  801157:	83 c4 10             	add    $0x10,%esp
  80115a:	85 c0                	test   %eax,%eax
  80115c:	78 31                	js     80118f <fork+0x186>
			panic("panic by alloc page");
		}
		//设置对应的异常处理函数。
		extern void _pgfault_upcall(void);
		flag=sys_env_set_pgfault_upcall(envid,_pgfault_upcall);
  80115e:	83 ec 08             	sub    $0x8,%esp
  801161:	68 43 21 80 00       	push   $0x802143
  801166:	57                   	push   %edi
  801167:	e8 c5 fc ff ff       	call   800e31 <sys_env_set_pgfault_upcall>
		if(flag<0){
  80116c:	83 c4 10             	add    $0x10,%esp
  80116f:	85 c0                	test   %eax,%eax
  801171:	78 33                	js     8011a6 <fork+0x19d>
			panic("panic by set pgfault upcall faction");
		}
		//设置子进程，等待调度。
		flag=sys_env_set_status(envid,ENV_RUNNABLE);
  801173:	83 ec 08             	sub    $0x8,%esp
  801176:	6a 02                	push   $0x2
  801178:	57                   	push   %edi
  801179:	e8 27 fc ff ff       	call   800da5 <sys_env_set_status>
		if(flag<0){
  80117e:	83 c4 10             	add    $0x10,%esp
  801181:	85 c0                	test   %eax,%eax
  801183:	78 38                	js     8011bd <fork+0x1b4>
		//否则报错。
		panic("panic by alloc envid");
	}

	
}
  801185:	89 f8                	mov    %edi,%eax
  801187:	8d 65 f4             	lea    -0xc(%ebp),%esp
  80118a:	5b                   	pop    %ebx
  80118b:	5e                   	pop    %esi
  80118c:	5f                   	pop    %edi
  80118d:	5d                   	pop    %ebp
  80118e:	c3                   	ret    
			panic("panic by alloc page");
  80118f:	83 ec 04             	sub    $0x4,%esp
  801192:	68 fc 28 80 00       	push   $0x8028fc
  801197:	68 98 00 00 00       	push   $0x98
  80119c:	68 9b 28 80 00       	push   $0x80289b
  8011a1:	e8 d9 0e 00 00       	call   80207f <_panic>
			panic("panic by set pgfault upcall faction");
  8011a6:	83 ec 04             	sub    $0x4,%esp
  8011a9:	68 50 28 80 00       	push   $0x802850
  8011ae:	68 9e 00 00 00       	push   $0x9e
  8011b3:	68 9b 28 80 00       	push   $0x80289b
  8011b8:	e8 c2 0e 00 00       	call   80207f <_panic>
			panic("panic by set env status to ENV_RUNABLE");
  8011bd:	83 ec 04             	sub    $0x4,%esp
  8011c0:	68 74 28 80 00       	push   $0x802874
  8011c5:	68 a3 00 00 00       	push   $0xa3
  8011ca:	68 9b 28 80 00       	push   $0x80289b
  8011cf:	e8 ab 0e 00 00       	call   80207f <_panic>
	else if(envid==0){
  8011d4:	75 19                	jne    8011ef <fork+0x1e6>
        thisenv = &envs[ENVX(sys_getenvid())];	//在子进程中设置thisenv为自己
  8011d6:	e8 b1 fa ff ff       	call   800c8c <sys_getenvid>
  8011db:	25 ff 03 00 00       	and    $0x3ff,%eax
  8011e0:	6b c0 7c             	imul   $0x7c,%eax,%eax
  8011e3:	05 00 00 c0 ee       	add    $0xeec00000,%eax
  8011e8:	a3 04 40 80 00       	mov    %eax,0x804004
		return 0;
  8011ed:	eb 96                	jmp    801185 <fork+0x17c>
		panic("panic by alloc envid");
  8011ef:	83 ec 04             	sub    $0x4,%esp
  8011f2:	68 10 29 80 00       	push   $0x802910
  8011f7:	68 ad 00 00 00       	push   $0xad
  8011fc:	68 9b 28 80 00       	push   $0x80289b
  801201:	e8 79 0e 00 00       	call   80207f <_panic>

00801206 <sfork>:

// Challenge!
int
sfork(void)
{
  801206:	f3 0f 1e fb          	endbr32 
  80120a:	55                   	push   %ebp
  80120b:	89 e5                	mov    %esp,%ebp
  80120d:	83 ec 0c             	sub    $0xc,%esp
	panic("sfork not implemented");
  801210:	68 25 29 80 00       	push   $0x802925
  801215:	68 b7 00 00 00       	push   $0xb7
  80121a:	68 9b 28 80 00       	push   $0x80289b
  80121f:	e8 5b 0e 00 00       	call   80207f <_panic>

00801224 <ipc_recv>:
//   If 'pg' is null, pass sys_ipc_recv a value that it will understand
//   as meaning "no page".  (Zero is not the right value, since that's
//   a perfectly valid place to map a page.)
int32_t
ipc_recv(envid_t *from_env_store, void *pg, int *perm_store)
{
  801224:	f3 0f 1e fb          	endbr32 
  801228:	55                   	push   %ebp
  801229:	89 e5                	mov    %esp,%ebp
  80122b:	56                   	push   %esi
  80122c:	53                   	push   %ebx
  80122d:	8b 75 08             	mov    0x8(%ebp),%esi
  801230:	8b 45 0c             	mov    0xc(%ebp),%eax
  801233:	8b 5d 10             	mov    0x10(%ebp),%ebx
	// LAB 4: Your code here.
	int error;
	if(!pg)pg = (void *)UTOP; // 如果设置为UTOP，这个值其实可以比UTOP大，设置为这个值认为pg无效了，不会进行页面传递【共享页面的设置】，而是只进行值value的传递。
  801236:	85 c0                	test   %eax,%eax
  801238:	ba 00 00 c0 ee       	mov    $0xeec00000,%edx
  80123d:	0f 44 c2             	cmove  %edx,%eax
	if((error = sys_ipc_recv(pg)) < 0){
  801240:	83 ec 0c             	sub    $0xc,%esp
  801243:	50                   	push   %eax
  801244:	e8 55 fc ff ff       	call   800e9e <sys_ipc_recv>
  801249:	83 c4 10             	add    $0x10,%esp
  80124c:	85 c0                	test   %eax,%eax
  80124e:	78 3f                	js     80128f <ipc_recv+0x6b>
		if(from_env_store)*from_env_store = 0;
		if(perm_store)*perm_store = 0;
		return error;
	}

	thisenv = &envs[ENVX(sys_getenvid())]; // for lab4's challenge sfork().
  801250:	e8 37 fa ff ff       	call   800c8c <sys_getenvid>
  801255:	25 ff 03 00 00       	and    $0x3ff,%eax
  80125a:	6b d0 7c             	imul   $0x7c,%eax,%edx
  80125d:	81 c2 00 00 c0 ee    	add    $0xeec00000,%edx
  801263:	89 15 04 40 80 00    	mov    %edx,0x804004

	if(from_env_store)*from_env_store = thisenv->env_ipc_from;
  801269:	85 f6                	test   %esi,%esi
  80126b:	74 05                	je     801272 <ipc_recv+0x4e>
  80126d:	8b 42 74             	mov    0x74(%edx),%eax
  801270:	89 06                	mov    %eax,(%esi)
	if(perm_store)*perm_store = thisenv->env_ipc_perm;
  801272:	85 db                	test   %ebx,%ebx
  801274:	74 0a                	je     801280 <ipc_recv+0x5c>
  801276:	a1 04 40 80 00       	mov    0x804004,%eax
  80127b:	8b 40 78             	mov    0x78(%eax),%eax
  80127e:	89 03                	mov    %eax,(%ebx)
	return thisenv->env_ipc_value;
  801280:	a1 04 40 80 00       	mov    0x804004,%eax
  801285:	8b 40 70             	mov    0x70(%eax),%eax
}
  801288:	8d 65 f8             	lea    -0x8(%ebp),%esp
  80128b:	5b                   	pop    %ebx
  80128c:	5e                   	pop    %esi
  80128d:	5d                   	pop    %ebp
  80128e:	c3                   	ret    
		if(from_env_store)*from_env_store = 0;
  80128f:	85 f6                	test   %esi,%esi
  801291:	74 06                	je     801299 <ipc_recv+0x75>
  801293:	c7 06 00 00 00 00    	movl   $0x0,(%esi)
		if(perm_store)*perm_store = 0;
  801299:	85 db                	test   %ebx,%ebx
  80129b:	74 eb                	je     801288 <ipc_recv+0x64>
  80129d:	c7 03 00 00 00 00    	movl   $0x0,(%ebx)
  8012a3:	eb e3                	jmp    801288 <ipc_recv+0x64>

008012a5 <ipc_send>:
//   Use sys_yield() to be CPU-friendly.
//   If 'pg' is null, pass sys_ipc_try_send a value that it will understand
//   as meaning "no page".  (Zero is not the right value.)
void
ipc_send(envid_t to_env, uint32_t val, void *pg, int perm)
{
  8012a5:	f3 0f 1e fb          	endbr32 
  8012a9:	55                   	push   %ebp
  8012aa:	89 e5                	mov    %esp,%ebp
  8012ac:	57                   	push   %edi
  8012ad:	56                   	push   %esi
  8012ae:	53                   	push   %ebx
  8012af:	83 ec 0c             	sub    $0xc,%esp
  8012b2:	8b 7d 08             	mov    0x8(%ebp),%edi
  8012b5:	8b 75 0c             	mov    0xc(%ebp),%esi
  8012b8:	8b 5d 10             	mov    0x10(%ebp),%ebx
	// LAB 4: Your code here.
	if(!pg)pg = (void *)UTOP; // 不会进行页面共享，只会sending message。
  8012bb:	85 db                	test   %ebx,%ebx
  8012bd:	b8 00 00 c0 ee       	mov    $0xeec00000,%eax
  8012c2:	0f 44 d8             	cmove  %eax,%ebx
	int error;
	// Keep trying until it succeeds.
	while((error = sys_ipc_try_send(to_env, val, pg, perm)) < 0){
  8012c5:	ff 75 14             	pushl  0x14(%ebp)
  8012c8:	53                   	push   %ebx
  8012c9:	56                   	push   %esi
  8012ca:	57                   	push   %edi
  8012cb:	e8 a7 fb ff ff       	call   800e77 <sys_ipc_try_send>
  8012d0:	83 c4 10             	add    $0x10,%esp
  8012d3:	85 c0                	test   %eax,%eax
  8012d5:	79 1e                	jns    8012f5 <ipc_send+0x50>
        //如果error是没有接收者，那么就会继续尝试send
		if(error != -E_IPC_NOT_RECV){
  8012d7:	83 f8 f9             	cmp    $0xfffffff9,%eax
  8012da:	75 07                	jne    8012e3 <ipc_send+0x3e>
			panic("sys_ipc_try_send:%e", error);
		}
        //但是不是一味的占用cpu，而是尝试一次就释放CPU，等待再次被调度，才会重新send，寻找receiver。
		sys_yield(); // To be CPU-friendly.
  8012dc:	e8 ce f9 ff ff       	call   800caf <sys_yield>
  8012e1:	eb e2                	jmp    8012c5 <ipc_send+0x20>
			panic("sys_ipc_try_send:%e", error);
  8012e3:	50                   	push   %eax
  8012e4:	68 3b 29 80 00       	push   $0x80293b
  8012e9:	6a 3b                	push   $0x3b
  8012eb:	68 4f 29 80 00       	push   $0x80294f
  8012f0:	e8 8a 0d 00 00       	call   80207f <_panic>
	}
}
  8012f5:	8d 65 f4             	lea    -0xc(%ebp),%esp
  8012f8:	5b                   	pop    %ebx
  8012f9:	5e                   	pop    %esi
  8012fa:	5f                   	pop    %edi
  8012fb:	5d                   	pop    %ebp
  8012fc:	c3                   	ret    

008012fd <ipc_find_env>:
// Find the first environment of the given type.  We'll use this to
// find special environments.
// Returns 0 if no such environment exists.
envid_t
ipc_find_env(enum EnvType type)
{
  8012fd:	f3 0f 1e fb          	endbr32 
  801301:	55                   	push   %ebp
  801302:	89 e5                	mov    %esp,%ebp
  801304:	8b 4d 08             	mov    0x8(%ebp),%ecx
	int i;
	for (i = 0; i < NENV; i++)
  801307:	b8 00 00 00 00       	mov    $0x0,%eax
		if (envs[i].env_type == type)
  80130c:	6b d0 7c             	imul   $0x7c,%eax,%edx
  80130f:	81 c2 00 00 c0 ee    	add    $0xeec00000,%edx
  801315:	8b 52 50             	mov    0x50(%edx),%edx
  801318:	39 ca                	cmp    %ecx,%edx
  80131a:	74 11                	je     80132d <ipc_find_env+0x30>
	for (i = 0; i < NENV; i++)
  80131c:	83 c0 01             	add    $0x1,%eax
  80131f:	3d 00 04 00 00       	cmp    $0x400,%eax
  801324:	75 e6                	jne    80130c <ipc_find_env+0xf>
			return envs[i].env_id;
	return 0;
  801326:	b8 00 00 00 00       	mov    $0x0,%eax
  80132b:	eb 0b                	jmp    801338 <ipc_find_env+0x3b>
			return envs[i].env_id;
  80132d:	6b c0 7c             	imul   $0x7c,%eax,%eax
  801330:	05 00 00 c0 ee       	add    $0xeec00000,%eax
  801335:	8b 40 48             	mov    0x48(%eax),%eax
}
  801338:	5d                   	pop    %ebp
  801339:	c3                   	ret    

0080133a <fd2num>:
// File descriptor manipulators
// --------------------------------------------------------------

int
fd2num(struct Fd *fd)
{
  80133a:	f3 0f 1e fb          	endbr32 
  80133e:	55                   	push   %ebp
  80133f:	89 e5                	mov    %esp,%ebp
	return ((uintptr_t) fd - FDTABLE) / PGSIZE;
  801341:	8b 45 08             	mov    0x8(%ebp),%eax
  801344:	05 00 00 00 30       	add    $0x30000000,%eax
  801349:	c1 e8 0c             	shr    $0xc,%eax
}
  80134c:	5d                   	pop    %ebp
  80134d:	c3                   	ret    

0080134e <fd2data>:

char*
fd2data(struct Fd *fd)
{
  80134e:	f3 0f 1e fb          	endbr32 
  801352:	55                   	push   %ebp
  801353:	89 e5                	mov    %esp,%ebp
	return ((uintptr_t) fd - FDTABLE) / PGSIZE;
  801355:	8b 45 08             	mov    0x8(%ebp),%eax
  801358:	05 00 00 00 30       	add    $0x30000000,%eax
	return INDEX2DATA(fd2num(fd));
  80135d:	25 00 f0 ff ff       	and    $0xfffff000,%eax
  801362:	2d 00 00 fe 2f       	sub    $0x2ffe0000,%eax
}
  801367:	5d                   	pop    %ebp
  801368:	c3                   	ret    

00801369 <fd_alloc>:
// Returns 0 on success, < 0 on error.  Errors are:
//	-E_MAX_FD: no more file descriptors
// On error, *fd_store is set to 0.
int
fd_alloc(struct Fd **fd_store)
{
  801369:	f3 0f 1e fb          	endbr32 
  80136d:	55                   	push   %ebp
  80136e:	89 e5                	mov    %esp,%ebp
  801370:	b8 00 00 00 d0       	mov    $0xd0000000,%eax
	int i;
	struct Fd *fd;

	for (i = 0; i < MAXFD; i++) {
		fd = INDEX2FD(i);
		if ((uvpd[PDX(fd)] & PTE_P) == 0 || (uvpt[PGNUM(fd)] & PTE_P) == 0) {
  801375:	89 c2                	mov    %eax,%edx
  801377:	c1 ea 16             	shr    $0x16,%edx
  80137a:	8b 14 95 00 d0 7b ef 	mov    -0x10843000(,%edx,4),%edx
  801381:	f6 c2 01             	test   $0x1,%dl
  801384:	74 2d                	je     8013b3 <fd_alloc+0x4a>
  801386:	89 c2                	mov    %eax,%edx
  801388:	c1 ea 0c             	shr    $0xc,%edx
  80138b:	8b 14 95 00 00 40 ef 	mov    -0x10c00000(,%edx,4),%edx
  801392:	f6 c2 01             	test   $0x1,%dl
  801395:	74 1c                	je     8013b3 <fd_alloc+0x4a>
  801397:	05 00 10 00 00       	add    $0x1000,%eax
	for (i = 0; i < MAXFD; i++) {
  80139c:	3d 00 00 02 d0       	cmp    $0xd0020000,%eax
  8013a1:	75 d2                	jne    801375 <fd_alloc+0xc>
			*fd_store = fd;
			return 0;
		}
	}
	*fd_store = 0;
  8013a3:	8b 45 08             	mov    0x8(%ebp),%eax
  8013a6:	c7 00 00 00 00 00    	movl   $0x0,(%eax)
	return -E_MAX_OPEN;
  8013ac:	b8 f6 ff ff ff       	mov    $0xfffffff6,%eax
  8013b1:	eb 0a                	jmp    8013bd <fd_alloc+0x54>
			*fd_store = fd;
  8013b3:	8b 4d 08             	mov    0x8(%ebp),%ecx
  8013b6:	89 01                	mov    %eax,(%ecx)
			return 0;
  8013b8:	b8 00 00 00 00       	mov    $0x0,%eax
}
  8013bd:	5d                   	pop    %ebp
  8013be:	c3                   	ret    

008013bf <fd_lookup>:
// Returns 0 on success (the page is in range and mapped), < 0 on error.
// Errors are:
//	-E_INVAL: fdnum was either not in range or not mapped.
int
fd_lookup(int fdnum, struct Fd **fd_store)
{
  8013bf:	f3 0f 1e fb          	endbr32 
  8013c3:	55                   	push   %ebp
  8013c4:	89 e5                	mov    %esp,%ebp
  8013c6:	8b 45 08             	mov    0x8(%ebp),%eax
	struct Fd *fd;

	if (fdnum < 0 || fdnum >= MAXFD) {
  8013c9:	83 f8 1f             	cmp    $0x1f,%eax
  8013cc:	77 30                	ja     8013fe <fd_lookup+0x3f>
		if (debug)
			cprintf("[%08x] bad fd %d\n", thisenv->env_id, fdnum);
		return -E_INVAL;
	}
	fd = INDEX2FD(fdnum);
  8013ce:	c1 e0 0c             	shl    $0xc,%eax
  8013d1:	2d 00 00 00 30       	sub    $0x30000000,%eax
	if (!(uvpd[PDX(fd)] & PTE_P) || !(uvpt[PGNUM(fd)] & PTE_P)) {
  8013d6:	8b 15 00 dd 7b ef    	mov    0xef7bdd00,%edx
  8013dc:	f6 c2 01             	test   $0x1,%dl
  8013df:	74 24                	je     801405 <fd_lookup+0x46>
  8013e1:	89 c2                	mov    %eax,%edx
  8013e3:	c1 ea 0c             	shr    $0xc,%edx
  8013e6:	8b 14 95 00 00 40 ef 	mov    -0x10c00000(,%edx,4),%edx
  8013ed:	f6 c2 01             	test   $0x1,%dl
  8013f0:	74 1a                	je     80140c <fd_lookup+0x4d>
		if (debug)
			cprintf("[%08x] closed fd %d\n", thisenv->env_id, fdnum);
		return -E_INVAL;
	}
	*fd_store = fd;
  8013f2:	8b 55 0c             	mov    0xc(%ebp),%edx
  8013f5:	89 02                	mov    %eax,(%edx)
	return 0;
  8013f7:	b8 00 00 00 00       	mov    $0x0,%eax
}
  8013fc:	5d                   	pop    %ebp
  8013fd:	c3                   	ret    
		return -E_INVAL;
  8013fe:	b8 fd ff ff ff       	mov    $0xfffffffd,%eax
  801403:	eb f7                	jmp    8013fc <fd_lookup+0x3d>
		return -E_INVAL;
  801405:	b8 fd ff ff ff       	mov    $0xfffffffd,%eax
  80140a:	eb f0                	jmp    8013fc <fd_lookup+0x3d>
  80140c:	b8 fd ff ff ff       	mov    $0xfffffffd,%eax
  801411:	eb e9                	jmp    8013fc <fd_lookup+0x3d>

00801413 <dev_lookup>:
	0
};

int
dev_lookup(int dev_id, struct Dev **dev)
{
  801413:	f3 0f 1e fb          	endbr32 
  801417:	55                   	push   %ebp
  801418:	89 e5                	mov    %esp,%ebp
  80141a:	83 ec 08             	sub    $0x8,%esp
  80141d:	8b 4d 08             	mov    0x8(%ebp),%ecx
  801420:	ba d8 29 80 00       	mov    $0x8029d8,%edx
	int i;
	for (i = 0; devtab[i]; i++)
  801425:	b8 0c 30 80 00       	mov    $0x80300c,%eax
		if (devtab[i]->dev_id == dev_id) {
  80142a:	39 08                	cmp    %ecx,(%eax)
  80142c:	74 33                	je     801461 <dev_lookup+0x4e>
  80142e:	83 c2 04             	add    $0x4,%edx
	for (i = 0; devtab[i]; i++)
  801431:	8b 02                	mov    (%edx),%eax
  801433:	85 c0                	test   %eax,%eax
  801435:	75 f3                	jne    80142a <dev_lookup+0x17>
			*dev = devtab[i];
			return 0;
		}
	cprintf("[%08x] unknown device type %d\n", thisenv->env_id, dev_id);
  801437:	a1 04 40 80 00       	mov    0x804004,%eax
  80143c:	8b 40 48             	mov    0x48(%eax),%eax
  80143f:	83 ec 04             	sub    $0x4,%esp
  801442:	51                   	push   %ecx
  801443:	50                   	push   %eax
  801444:	68 5c 29 80 00       	push   $0x80295c
  801449:	e8 69 ee ff ff       	call   8002b7 <cprintf>
	*dev = 0;
  80144e:	8b 45 0c             	mov    0xc(%ebp),%eax
  801451:	c7 00 00 00 00 00    	movl   $0x0,(%eax)
	return -E_INVAL;
  801457:	83 c4 10             	add    $0x10,%esp
  80145a:	b8 fd ff ff ff       	mov    $0xfffffffd,%eax
}
  80145f:	c9                   	leave  
  801460:	c3                   	ret    
			*dev = devtab[i];
  801461:	8b 4d 0c             	mov    0xc(%ebp),%ecx
  801464:	89 01                	mov    %eax,(%ecx)
			return 0;
  801466:	b8 00 00 00 00       	mov    $0x0,%eax
  80146b:	eb f2                	jmp    80145f <dev_lookup+0x4c>

0080146d <fd_close>:
{
  80146d:	f3 0f 1e fb          	endbr32 
  801471:	55                   	push   %ebp
  801472:	89 e5                	mov    %esp,%ebp
  801474:	57                   	push   %edi
  801475:	56                   	push   %esi
  801476:	53                   	push   %ebx
  801477:	83 ec 24             	sub    $0x24,%esp
  80147a:	8b 75 08             	mov    0x8(%ebp),%esi
  80147d:	8b 7d 0c             	mov    0xc(%ebp),%edi
	if ((r = fd_lookup(fd2num(fd), &fd2)) < 0
  801480:	8d 45 e4             	lea    -0x1c(%ebp),%eax
  801483:	50                   	push   %eax
	return ((uintptr_t) fd - FDTABLE) / PGSIZE;
  801484:	8d 86 00 00 00 30    	lea    0x30000000(%esi),%eax
  80148a:	c1 e8 0c             	shr    $0xc,%eax
	if ((r = fd_lookup(fd2num(fd), &fd2)) < 0
  80148d:	50                   	push   %eax
  80148e:	e8 2c ff ff ff       	call   8013bf <fd_lookup>
  801493:	89 c3                	mov    %eax,%ebx
  801495:	83 c4 10             	add    $0x10,%esp
  801498:	85 c0                	test   %eax,%eax
  80149a:	78 05                	js     8014a1 <fd_close+0x34>
	    || fd != fd2)
  80149c:	39 75 e4             	cmp    %esi,-0x1c(%ebp)
  80149f:	74 16                	je     8014b7 <fd_close+0x4a>
		return (must_exist ? r : 0);
  8014a1:	89 f8                	mov    %edi,%eax
  8014a3:	84 c0                	test   %al,%al
  8014a5:	b8 00 00 00 00       	mov    $0x0,%eax
  8014aa:	0f 44 d8             	cmove  %eax,%ebx
}
  8014ad:	89 d8                	mov    %ebx,%eax
  8014af:	8d 65 f4             	lea    -0xc(%ebp),%esp
  8014b2:	5b                   	pop    %ebx
  8014b3:	5e                   	pop    %esi
  8014b4:	5f                   	pop    %edi
  8014b5:	5d                   	pop    %ebp
  8014b6:	c3                   	ret    
	if ((r = dev_lookup(fd->fd_dev_id, &dev)) >= 0) {
  8014b7:	83 ec 08             	sub    $0x8,%esp
  8014ba:	8d 45 e0             	lea    -0x20(%ebp),%eax
  8014bd:	50                   	push   %eax
  8014be:	ff 36                	pushl  (%esi)
  8014c0:	e8 4e ff ff ff       	call   801413 <dev_lookup>
  8014c5:	89 c3                	mov    %eax,%ebx
  8014c7:	83 c4 10             	add    $0x10,%esp
  8014ca:	85 c0                	test   %eax,%eax
  8014cc:	78 1a                	js     8014e8 <fd_close+0x7b>
		if (dev->dev_close)
  8014ce:	8b 45 e0             	mov    -0x20(%ebp),%eax
  8014d1:	8b 40 10             	mov    0x10(%eax),%eax
			r = 0;
  8014d4:	bb 00 00 00 00       	mov    $0x0,%ebx
		if (dev->dev_close)
  8014d9:	85 c0                	test   %eax,%eax
  8014db:	74 0b                	je     8014e8 <fd_close+0x7b>
			r = (*dev->dev_close)(fd);
  8014dd:	83 ec 0c             	sub    $0xc,%esp
  8014e0:	56                   	push   %esi
  8014e1:	ff d0                	call   *%eax
  8014e3:	89 c3                	mov    %eax,%ebx
  8014e5:	83 c4 10             	add    $0x10,%esp
	(void) sys_page_unmap(0, fd);
  8014e8:	83 ec 08             	sub    $0x8,%esp
  8014eb:	56                   	push   %esi
  8014ec:	6a 00                	push   $0x0
  8014ee:	e8 6c f8 ff ff       	call   800d5f <sys_page_unmap>
	return r;
  8014f3:	83 c4 10             	add    $0x10,%esp
  8014f6:	eb b5                	jmp    8014ad <fd_close+0x40>

008014f8 <close>:

int
close(int fdnum)
{
  8014f8:	f3 0f 1e fb          	endbr32 
  8014fc:	55                   	push   %ebp
  8014fd:	89 e5                	mov    %esp,%ebp
  8014ff:	83 ec 20             	sub    $0x20,%esp
	struct Fd *fd;
	int r;

	if ((r = fd_lookup(fdnum, &fd)) < 0)
  801502:	8d 45 f4             	lea    -0xc(%ebp),%eax
  801505:	50                   	push   %eax
  801506:	ff 75 08             	pushl  0x8(%ebp)
  801509:	e8 b1 fe ff ff       	call   8013bf <fd_lookup>
  80150e:	83 c4 10             	add    $0x10,%esp
  801511:	85 c0                	test   %eax,%eax
  801513:	79 02                	jns    801517 <close+0x1f>
		return r;
	else
		return fd_close(fd, 1);
}
  801515:	c9                   	leave  
  801516:	c3                   	ret    
		return fd_close(fd, 1);
  801517:	83 ec 08             	sub    $0x8,%esp
  80151a:	6a 01                	push   $0x1
  80151c:	ff 75 f4             	pushl  -0xc(%ebp)
  80151f:	e8 49 ff ff ff       	call   80146d <fd_close>
  801524:	83 c4 10             	add    $0x10,%esp
  801527:	eb ec                	jmp    801515 <close+0x1d>

00801529 <close_all>:

void
close_all(void)
{
  801529:	f3 0f 1e fb          	endbr32 
  80152d:	55                   	push   %ebp
  80152e:	89 e5                	mov    %esp,%ebp
  801530:	53                   	push   %ebx
  801531:	83 ec 04             	sub    $0x4,%esp
	int i;
	for (i = 0; i < MAXFD; i++)
  801534:	bb 00 00 00 00       	mov    $0x0,%ebx
		close(i);
  801539:	83 ec 0c             	sub    $0xc,%esp
  80153c:	53                   	push   %ebx
  80153d:	e8 b6 ff ff ff       	call   8014f8 <close>
	for (i = 0; i < MAXFD; i++)
  801542:	83 c3 01             	add    $0x1,%ebx
  801545:	83 c4 10             	add    $0x10,%esp
  801548:	83 fb 20             	cmp    $0x20,%ebx
  80154b:	75 ec                	jne    801539 <close_all+0x10>
}
  80154d:	8b 5d fc             	mov    -0x4(%ebp),%ebx
  801550:	c9                   	leave  
  801551:	c3                   	ret    

00801552 <dup>:
// file and the file offset of the other.
// Closes any previously open file descriptor at 'newfdnum'.
// This is implemented using virtual memory tricks (of course!).
int
dup(int oldfdnum, int newfdnum)
{
  801552:	f3 0f 1e fb          	endbr32 
  801556:	55                   	push   %ebp
  801557:	89 e5                	mov    %esp,%ebp
  801559:	57                   	push   %edi
  80155a:	56                   	push   %esi
  80155b:	53                   	push   %ebx
  80155c:	83 ec 24             	sub    $0x24,%esp
	int r;
	char *ova, *nva;
	pte_t pte;
	struct Fd *oldfd, *newfd;

	if ((r = fd_lookup(oldfdnum, &oldfd)) < 0)
  80155f:	8d 45 e4             	lea    -0x1c(%ebp),%eax
  801562:	50                   	push   %eax
  801563:	ff 75 08             	pushl  0x8(%ebp)
  801566:	e8 54 fe ff ff       	call   8013bf <fd_lookup>
  80156b:	89 c3                	mov    %eax,%ebx
  80156d:	83 c4 10             	add    $0x10,%esp
  801570:	85 c0                	test   %eax,%eax
  801572:	0f 88 81 00 00 00    	js     8015f9 <dup+0xa7>
		return r;
	close(newfdnum);
  801578:	83 ec 0c             	sub    $0xc,%esp
  80157b:	ff 75 0c             	pushl  0xc(%ebp)
  80157e:	e8 75 ff ff ff       	call   8014f8 <close>

	newfd = INDEX2FD(newfdnum);
  801583:	8b 75 0c             	mov    0xc(%ebp),%esi
  801586:	c1 e6 0c             	shl    $0xc,%esi
  801589:	81 ee 00 00 00 30    	sub    $0x30000000,%esi
	ova = fd2data(oldfd);
  80158f:	83 c4 04             	add    $0x4,%esp
  801592:	ff 75 e4             	pushl  -0x1c(%ebp)
  801595:	e8 b4 fd ff ff       	call   80134e <fd2data>
  80159a:	89 c3                	mov    %eax,%ebx
	nva = fd2data(newfd);
  80159c:	89 34 24             	mov    %esi,(%esp)
  80159f:	e8 aa fd ff ff       	call   80134e <fd2data>
  8015a4:	83 c4 10             	add    $0x10,%esp
  8015a7:	89 c7                	mov    %eax,%edi

	if ((uvpd[PDX(ova)] & PTE_P) && (uvpt[PGNUM(ova)] & PTE_P))
  8015a9:	89 d8                	mov    %ebx,%eax
  8015ab:	c1 e8 16             	shr    $0x16,%eax
  8015ae:	8b 04 85 00 d0 7b ef 	mov    -0x10843000(,%eax,4),%eax
  8015b5:	a8 01                	test   $0x1,%al
  8015b7:	74 11                	je     8015ca <dup+0x78>
  8015b9:	89 d8                	mov    %ebx,%eax
  8015bb:	c1 e8 0c             	shr    $0xc,%eax
  8015be:	8b 14 85 00 00 40 ef 	mov    -0x10c00000(,%eax,4),%edx
  8015c5:	f6 c2 01             	test   $0x1,%dl
  8015c8:	75 39                	jne    801603 <dup+0xb1>
		if ((r = sys_page_map(0, ova, 0, nva, uvpt[PGNUM(ova)] & PTE_SYSCALL)) < 0)
			goto err;
	if ((r = sys_page_map(0, oldfd, 0, newfd, uvpt[PGNUM(oldfd)] & PTE_SYSCALL)) < 0)
  8015ca:	8b 55 e4             	mov    -0x1c(%ebp),%edx
  8015cd:	89 d0                	mov    %edx,%eax
  8015cf:	c1 e8 0c             	shr    $0xc,%eax
  8015d2:	8b 04 85 00 00 40 ef 	mov    -0x10c00000(,%eax,4),%eax
  8015d9:	83 ec 0c             	sub    $0xc,%esp
  8015dc:	25 07 0e 00 00       	and    $0xe07,%eax
  8015e1:	50                   	push   %eax
  8015e2:	56                   	push   %esi
  8015e3:	6a 00                	push   $0x0
  8015e5:	52                   	push   %edx
  8015e6:	6a 00                	push   $0x0
  8015e8:	e8 2c f7 ff ff       	call   800d19 <sys_page_map>
  8015ed:	89 c3                	mov    %eax,%ebx
  8015ef:	83 c4 20             	add    $0x20,%esp
  8015f2:	85 c0                	test   %eax,%eax
  8015f4:	78 31                	js     801627 <dup+0xd5>
		goto err;

	return newfdnum;
  8015f6:	8b 5d 0c             	mov    0xc(%ebp),%ebx

err:
	sys_page_unmap(0, newfd);
	sys_page_unmap(0, nva);
	return r;
}
  8015f9:	89 d8                	mov    %ebx,%eax
  8015fb:	8d 65 f4             	lea    -0xc(%ebp),%esp
  8015fe:	5b                   	pop    %ebx
  8015ff:	5e                   	pop    %esi
  801600:	5f                   	pop    %edi
  801601:	5d                   	pop    %ebp
  801602:	c3                   	ret    
		if ((r = sys_page_map(0, ova, 0, nva, uvpt[PGNUM(ova)] & PTE_SYSCALL)) < 0)
  801603:	8b 04 85 00 00 40 ef 	mov    -0x10c00000(,%eax,4),%eax
  80160a:	83 ec 0c             	sub    $0xc,%esp
  80160d:	25 07 0e 00 00       	and    $0xe07,%eax
  801612:	50                   	push   %eax
  801613:	57                   	push   %edi
  801614:	6a 00                	push   $0x0
  801616:	53                   	push   %ebx
  801617:	6a 00                	push   $0x0
  801619:	e8 fb f6 ff ff       	call   800d19 <sys_page_map>
  80161e:	89 c3                	mov    %eax,%ebx
  801620:	83 c4 20             	add    $0x20,%esp
  801623:	85 c0                	test   %eax,%eax
  801625:	79 a3                	jns    8015ca <dup+0x78>
	sys_page_unmap(0, newfd);
  801627:	83 ec 08             	sub    $0x8,%esp
  80162a:	56                   	push   %esi
  80162b:	6a 00                	push   $0x0
  80162d:	e8 2d f7 ff ff       	call   800d5f <sys_page_unmap>
	sys_page_unmap(0, nva);
  801632:	83 c4 08             	add    $0x8,%esp
  801635:	57                   	push   %edi
  801636:	6a 00                	push   $0x0
  801638:	e8 22 f7 ff ff       	call   800d5f <sys_page_unmap>
	return r;
  80163d:	83 c4 10             	add    $0x10,%esp
  801640:	eb b7                	jmp    8015f9 <dup+0xa7>

00801642 <read>:

ssize_t
read(int fdnum, void *buf, size_t n)
{
  801642:	f3 0f 1e fb          	endbr32 
  801646:	55                   	push   %ebp
  801647:	89 e5                	mov    %esp,%ebp
  801649:	53                   	push   %ebx
  80164a:	83 ec 1c             	sub    $0x1c,%esp
  80164d:	8b 5d 08             	mov    0x8(%ebp),%ebx
	int r;
	struct Dev *dev;
	struct Fd *fd;

	if ((r = fd_lookup(fdnum, &fd)) < 0
  801650:	8d 45 f0             	lea    -0x10(%ebp),%eax
  801653:	50                   	push   %eax
  801654:	53                   	push   %ebx
  801655:	e8 65 fd ff ff       	call   8013bf <fd_lookup>
  80165a:	83 c4 10             	add    $0x10,%esp
  80165d:	85 c0                	test   %eax,%eax
  80165f:	78 3f                	js     8016a0 <read+0x5e>
	    || (r = dev_lookup(fd->fd_dev_id, &dev)) < 0)
  801661:	83 ec 08             	sub    $0x8,%esp
  801664:	8d 45 f4             	lea    -0xc(%ebp),%eax
  801667:	50                   	push   %eax
  801668:	8b 45 f0             	mov    -0x10(%ebp),%eax
  80166b:	ff 30                	pushl  (%eax)
  80166d:	e8 a1 fd ff ff       	call   801413 <dev_lookup>
  801672:	83 c4 10             	add    $0x10,%esp
  801675:	85 c0                	test   %eax,%eax
  801677:	78 27                	js     8016a0 <read+0x5e>
		return r;
	if ((fd->fd_omode & O_ACCMODE) == O_WRONLY) {
  801679:	8b 55 f0             	mov    -0x10(%ebp),%edx
  80167c:	8b 42 08             	mov    0x8(%edx),%eax
  80167f:	83 e0 03             	and    $0x3,%eax
  801682:	83 f8 01             	cmp    $0x1,%eax
  801685:	74 1e                	je     8016a5 <read+0x63>
		cprintf("[%08x] read %d -- bad mode\n", thisenv->env_id, fdnum);
		return -E_INVAL;
	}
	if (!dev->dev_read)
  801687:	8b 45 f4             	mov    -0xc(%ebp),%eax
  80168a:	8b 40 08             	mov    0x8(%eax),%eax
  80168d:	85 c0                	test   %eax,%eax
  80168f:	74 35                	je     8016c6 <read+0x84>
		return -E_NOT_SUPP;
	return (*dev->dev_read)(fd, buf, n);
  801691:	83 ec 04             	sub    $0x4,%esp
  801694:	ff 75 10             	pushl  0x10(%ebp)
  801697:	ff 75 0c             	pushl  0xc(%ebp)
  80169a:	52                   	push   %edx
  80169b:	ff d0                	call   *%eax
  80169d:	83 c4 10             	add    $0x10,%esp
}
  8016a0:	8b 5d fc             	mov    -0x4(%ebp),%ebx
  8016a3:	c9                   	leave  
  8016a4:	c3                   	ret    
		cprintf("[%08x] read %d -- bad mode\n", thisenv->env_id, fdnum);
  8016a5:	a1 04 40 80 00       	mov    0x804004,%eax
  8016aa:	8b 40 48             	mov    0x48(%eax),%eax
  8016ad:	83 ec 04             	sub    $0x4,%esp
  8016b0:	53                   	push   %ebx
  8016b1:	50                   	push   %eax
  8016b2:	68 9d 29 80 00       	push   $0x80299d
  8016b7:	e8 fb eb ff ff       	call   8002b7 <cprintf>
		return -E_INVAL;
  8016bc:	83 c4 10             	add    $0x10,%esp
  8016bf:	b8 fd ff ff ff       	mov    $0xfffffffd,%eax
  8016c4:	eb da                	jmp    8016a0 <read+0x5e>
		return -E_NOT_SUPP;
  8016c6:	b8 f1 ff ff ff       	mov    $0xfffffff1,%eax
  8016cb:	eb d3                	jmp    8016a0 <read+0x5e>

008016cd <readn>:

ssize_t
readn(int fdnum, void *buf, size_t n)
{
  8016cd:	f3 0f 1e fb          	endbr32 
  8016d1:	55                   	push   %ebp
  8016d2:	89 e5                	mov    %esp,%ebp
  8016d4:	57                   	push   %edi
  8016d5:	56                   	push   %esi
  8016d6:	53                   	push   %ebx
  8016d7:	83 ec 0c             	sub    $0xc,%esp
  8016da:	8b 7d 08             	mov    0x8(%ebp),%edi
  8016dd:	8b 75 10             	mov    0x10(%ebp),%esi
	int m, tot;

	for (tot = 0; tot < n; tot += m) {
  8016e0:	bb 00 00 00 00       	mov    $0x0,%ebx
  8016e5:	eb 02                	jmp    8016e9 <readn+0x1c>
  8016e7:	01 c3                	add    %eax,%ebx
  8016e9:	39 f3                	cmp    %esi,%ebx
  8016eb:	73 21                	jae    80170e <readn+0x41>
		m = read(fdnum, (char*)buf + tot, n - tot);
  8016ed:	83 ec 04             	sub    $0x4,%esp
  8016f0:	89 f0                	mov    %esi,%eax
  8016f2:	29 d8                	sub    %ebx,%eax
  8016f4:	50                   	push   %eax
  8016f5:	89 d8                	mov    %ebx,%eax
  8016f7:	03 45 0c             	add    0xc(%ebp),%eax
  8016fa:	50                   	push   %eax
  8016fb:	57                   	push   %edi
  8016fc:	e8 41 ff ff ff       	call   801642 <read>
		if (m < 0)
  801701:	83 c4 10             	add    $0x10,%esp
  801704:	85 c0                	test   %eax,%eax
  801706:	78 04                	js     80170c <readn+0x3f>
			return m;
		if (m == 0)
  801708:	75 dd                	jne    8016e7 <readn+0x1a>
  80170a:	eb 02                	jmp    80170e <readn+0x41>
		m = read(fdnum, (char*)buf + tot, n - tot);
  80170c:	89 c3                	mov    %eax,%ebx
			break;
	}
	return tot;
}
  80170e:	89 d8                	mov    %ebx,%eax
  801710:	8d 65 f4             	lea    -0xc(%ebp),%esp
  801713:	5b                   	pop    %ebx
  801714:	5e                   	pop    %esi
  801715:	5f                   	pop    %edi
  801716:	5d                   	pop    %ebp
  801717:	c3                   	ret    

00801718 <write>:

ssize_t
write(int fdnum, const void *buf, size_t n)
{
  801718:	f3 0f 1e fb          	endbr32 
  80171c:	55                   	push   %ebp
  80171d:	89 e5                	mov    %esp,%ebp
  80171f:	53                   	push   %ebx
  801720:	83 ec 1c             	sub    $0x1c,%esp
  801723:	8b 5d 08             	mov    0x8(%ebp),%ebx
	int r;
	struct Dev *dev;
	struct Fd *fd;

	if ((r = fd_lookup(fdnum, &fd)) < 0
  801726:	8d 45 f0             	lea    -0x10(%ebp),%eax
  801729:	50                   	push   %eax
  80172a:	53                   	push   %ebx
  80172b:	e8 8f fc ff ff       	call   8013bf <fd_lookup>
  801730:	83 c4 10             	add    $0x10,%esp
  801733:	85 c0                	test   %eax,%eax
  801735:	78 3a                	js     801771 <write+0x59>
	    || (r = dev_lookup(fd->fd_dev_id, &dev)) < 0)
  801737:	83 ec 08             	sub    $0x8,%esp
  80173a:	8d 45 f4             	lea    -0xc(%ebp),%eax
  80173d:	50                   	push   %eax
  80173e:	8b 45 f0             	mov    -0x10(%ebp),%eax
  801741:	ff 30                	pushl  (%eax)
  801743:	e8 cb fc ff ff       	call   801413 <dev_lookup>
  801748:	83 c4 10             	add    $0x10,%esp
  80174b:	85 c0                	test   %eax,%eax
  80174d:	78 22                	js     801771 <write+0x59>
		return r;
	if ((fd->fd_omode & O_ACCMODE) == O_RDONLY) {
  80174f:	8b 45 f0             	mov    -0x10(%ebp),%eax
  801752:	f6 40 08 03          	testb  $0x3,0x8(%eax)
  801756:	74 1e                	je     801776 <write+0x5e>
		return -E_INVAL;
	}
	if (debug)
		cprintf("write %d %p %d via dev %s\n",
			fdnum, buf, n, dev->dev_name);
	if (!dev->dev_write)
  801758:	8b 55 f4             	mov    -0xc(%ebp),%edx
  80175b:	8b 52 0c             	mov    0xc(%edx),%edx
  80175e:	85 d2                	test   %edx,%edx
  801760:	74 35                	je     801797 <write+0x7f>
		return -E_NOT_SUPP;
	return (*dev->dev_write)(fd, buf, n);
  801762:	83 ec 04             	sub    $0x4,%esp
  801765:	ff 75 10             	pushl  0x10(%ebp)
  801768:	ff 75 0c             	pushl  0xc(%ebp)
  80176b:	50                   	push   %eax
  80176c:	ff d2                	call   *%edx
  80176e:	83 c4 10             	add    $0x10,%esp
}
  801771:	8b 5d fc             	mov    -0x4(%ebp),%ebx
  801774:	c9                   	leave  
  801775:	c3                   	ret    
		cprintf("[%08x] write %d -- bad mode\n", thisenv->env_id, fdnum);
  801776:	a1 04 40 80 00       	mov    0x804004,%eax
  80177b:	8b 40 48             	mov    0x48(%eax),%eax
  80177e:	83 ec 04             	sub    $0x4,%esp
  801781:	53                   	push   %ebx
  801782:	50                   	push   %eax
  801783:	68 b9 29 80 00       	push   $0x8029b9
  801788:	e8 2a eb ff ff       	call   8002b7 <cprintf>
		return -E_INVAL;
  80178d:	83 c4 10             	add    $0x10,%esp
  801790:	b8 fd ff ff ff       	mov    $0xfffffffd,%eax
  801795:	eb da                	jmp    801771 <write+0x59>
		return -E_NOT_SUPP;
  801797:	b8 f1 ff ff ff       	mov    $0xfffffff1,%eax
  80179c:	eb d3                	jmp    801771 <write+0x59>

0080179e <seek>:

int
seek(int fdnum, off_t offset)
{
  80179e:	f3 0f 1e fb          	endbr32 
  8017a2:	55                   	push   %ebp
  8017a3:	89 e5                	mov    %esp,%ebp
  8017a5:	83 ec 20             	sub    $0x20,%esp
	int r;
	struct Fd *fd;

	if ((r = fd_lookup(fdnum, &fd)) < 0)
  8017a8:	8d 45 f4             	lea    -0xc(%ebp),%eax
  8017ab:	50                   	push   %eax
  8017ac:	ff 75 08             	pushl  0x8(%ebp)
  8017af:	e8 0b fc ff ff       	call   8013bf <fd_lookup>
  8017b4:	83 c4 10             	add    $0x10,%esp
  8017b7:	85 c0                	test   %eax,%eax
  8017b9:	78 0e                	js     8017c9 <seek+0x2b>
		return r;
	fd->fd_offset = offset;
  8017bb:	8b 55 0c             	mov    0xc(%ebp),%edx
  8017be:	8b 45 f4             	mov    -0xc(%ebp),%eax
  8017c1:	89 50 04             	mov    %edx,0x4(%eax)
	return 0;
  8017c4:	b8 00 00 00 00       	mov    $0x0,%eax
}
  8017c9:	c9                   	leave  
  8017ca:	c3                   	ret    

008017cb <ftruncate>:

int
ftruncate(int fdnum, off_t newsize)
{
  8017cb:	f3 0f 1e fb          	endbr32 
  8017cf:	55                   	push   %ebp
  8017d0:	89 e5                	mov    %esp,%ebp
  8017d2:	53                   	push   %ebx
  8017d3:	83 ec 1c             	sub    $0x1c,%esp
  8017d6:	8b 5d 08             	mov    0x8(%ebp),%ebx
	int r;
	struct Dev *dev;
	struct Fd *fd;
	if ((r = fd_lookup(fdnum, &fd)) < 0
  8017d9:	8d 45 f0             	lea    -0x10(%ebp),%eax
  8017dc:	50                   	push   %eax
  8017dd:	53                   	push   %ebx
  8017de:	e8 dc fb ff ff       	call   8013bf <fd_lookup>
  8017e3:	83 c4 10             	add    $0x10,%esp
  8017e6:	85 c0                	test   %eax,%eax
  8017e8:	78 37                	js     801821 <ftruncate+0x56>
	    || (r = dev_lookup(fd->fd_dev_id, &dev)) < 0)
  8017ea:	83 ec 08             	sub    $0x8,%esp
  8017ed:	8d 45 f4             	lea    -0xc(%ebp),%eax
  8017f0:	50                   	push   %eax
  8017f1:	8b 45 f0             	mov    -0x10(%ebp),%eax
  8017f4:	ff 30                	pushl  (%eax)
  8017f6:	e8 18 fc ff ff       	call   801413 <dev_lookup>
  8017fb:	83 c4 10             	add    $0x10,%esp
  8017fe:	85 c0                	test   %eax,%eax
  801800:	78 1f                	js     801821 <ftruncate+0x56>
		return r;
	if ((fd->fd_omode & O_ACCMODE) == O_RDONLY) {
  801802:	8b 45 f0             	mov    -0x10(%ebp),%eax
  801805:	f6 40 08 03          	testb  $0x3,0x8(%eax)
  801809:	74 1b                	je     801826 <ftruncate+0x5b>
		cprintf("[%08x] ftruncate %d -- bad mode\n",
			thisenv->env_id, fdnum);
		return -E_INVAL;
	}
	if (!dev->dev_trunc)
  80180b:	8b 55 f4             	mov    -0xc(%ebp),%edx
  80180e:	8b 52 18             	mov    0x18(%edx),%edx
  801811:	85 d2                	test   %edx,%edx
  801813:	74 32                	je     801847 <ftruncate+0x7c>
		return -E_NOT_SUPP;
	return (*dev->dev_trunc)(fd, newsize);
  801815:	83 ec 08             	sub    $0x8,%esp
  801818:	ff 75 0c             	pushl  0xc(%ebp)
  80181b:	50                   	push   %eax
  80181c:	ff d2                	call   *%edx
  80181e:	83 c4 10             	add    $0x10,%esp
}
  801821:	8b 5d fc             	mov    -0x4(%ebp),%ebx
  801824:	c9                   	leave  
  801825:	c3                   	ret    
			thisenv->env_id, fdnum);
  801826:	a1 04 40 80 00       	mov    0x804004,%eax
		cprintf("[%08x] ftruncate %d -- bad mode\n",
  80182b:	8b 40 48             	mov    0x48(%eax),%eax
  80182e:	83 ec 04             	sub    $0x4,%esp
  801831:	53                   	push   %ebx
  801832:	50                   	push   %eax
  801833:	68 7c 29 80 00       	push   $0x80297c
  801838:	e8 7a ea ff ff       	call   8002b7 <cprintf>
		return -E_INVAL;
  80183d:	83 c4 10             	add    $0x10,%esp
  801840:	b8 fd ff ff ff       	mov    $0xfffffffd,%eax
  801845:	eb da                	jmp    801821 <ftruncate+0x56>
		return -E_NOT_SUPP;
  801847:	b8 f1 ff ff ff       	mov    $0xfffffff1,%eax
  80184c:	eb d3                	jmp    801821 <ftruncate+0x56>

0080184e <fstat>:

int
fstat(int fdnum, struct Stat *stat)
{
  80184e:	f3 0f 1e fb          	endbr32 
  801852:	55                   	push   %ebp
  801853:	89 e5                	mov    %esp,%ebp
  801855:	53                   	push   %ebx
  801856:	83 ec 1c             	sub    $0x1c,%esp
  801859:	8b 5d 0c             	mov    0xc(%ebp),%ebx
	int r;
	struct Dev *dev;
	struct Fd *fd;

	if ((r = fd_lookup(fdnum, &fd)) < 0
  80185c:	8d 45 f0             	lea    -0x10(%ebp),%eax
  80185f:	50                   	push   %eax
  801860:	ff 75 08             	pushl  0x8(%ebp)
  801863:	e8 57 fb ff ff       	call   8013bf <fd_lookup>
  801868:	83 c4 10             	add    $0x10,%esp
  80186b:	85 c0                	test   %eax,%eax
  80186d:	78 4b                	js     8018ba <fstat+0x6c>
	    || (r = dev_lookup(fd->fd_dev_id, &dev)) < 0)
  80186f:	83 ec 08             	sub    $0x8,%esp
  801872:	8d 45 f4             	lea    -0xc(%ebp),%eax
  801875:	50                   	push   %eax
  801876:	8b 45 f0             	mov    -0x10(%ebp),%eax
  801879:	ff 30                	pushl  (%eax)
  80187b:	e8 93 fb ff ff       	call   801413 <dev_lookup>
  801880:	83 c4 10             	add    $0x10,%esp
  801883:	85 c0                	test   %eax,%eax
  801885:	78 33                	js     8018ba <fstat+0x6c>
		return r;
	if (!dev->dev_stat)
  801887:	8b 45 f4             	mov    -0xc(%ebp),%eax
  80188a:	83 78 14 00          	cmpl   $0x0,0x14(%eax)
  80188e:	74 2f                	je     8018bf <fstat+0x71>
		return -E_NOT_SUPP;
	stat->st_name[0] = 0;
  801890:	c6 03 00             	movb   $0x0,(%ebx)
	stat->st_size = 0;
  801893:	c7 83 80 00 00 00 00 	movl   $0x0,0x80(%ebx)
  80189a:	00 00 00 
	stat->st_isdir = 0;
  80189d:	c7 83 84 00 00 00 00 	movl   $0x0,0x84(%ebx)
  8018a4:	00 00 00 
	stat->st_dev = dev;
  8018a7:	89 83 88 00 00 00    	mov    %eax,0x88(%ebx)
	return (*dev->dev_stat)(fd, stat);
  8018ad:	83 ec 08             	sub    $0x8,%esp
  8018b0:	53                   	push   %ebx
  8018b1:	ff 75 f0             	pushl  -0x10(%ebp)
  8018b4:	ff 50 14             	call   *0x14(%eax)
  8018b7:	83 c4 10             	add    $0x10,%esp
}
  8018ba:	8b 5d fc             	mov    -0x4(%ebp),%ebx
  8018bd:	c9                   	leave  
  8018be:	c3                   	ret    
		return -E_NOT_SUPP;
  8018bf:	b8 f1 ff ff ff       	mov    $0xfffffff1,%eax
  8018c4:	eb f4                	jmp    8018ba <fstat+0x6c>

008018c6 <stat>:

int
stat(const char *path, struct Stat *stat)
{
  8018c6:	f3 0f 1e fb          	endbr32 
  8018ca:	55                   	push   %ebp
  8018cb:	89 e5                	mov    %esp,%ebp
  8018cd:	56                   	push   %esi
  8018ce:	53                   	push   %ebx
	int fd, r;

	if ((fd = open(path, O_RDONLY)) < 0)
  8018cf:	83 ec 08             	sub    $0x8,%esp
  8018d2:	6a 00                	push   $0x0
  8018d4:	ff 75 08             	pushl  0x8(%ebp)
  8018d7:	e8 fb 01 00 00       	call   801ad7 <open>
  8018dc:	89 c3                	mov    %eax,%ebx
  8018de:	83 c4 10             	add    $0x10,%esp
  8018e1:	85 c0                	test   %eax,%eax
  8018e3:	78 1b                	js     801900 <stat+0x3a>
		return fd;
	r = fstat(fd, stat);
  8018e5:	83 ec 08             	sub    $0x8,%esp
  8018e8:	ff 75 0c             	pushl  0xc(%ebp)
  8018eb:	50                   	push   %eax
  8018ec:	e8 5d ff ff ff       	call   80184e <fstat>
  8018f1:	89 c6                	mov    %eax,%esi
	close(fd);
  8018f3:	89 1c 24             	mov    %ebx,(%esp)
  8018f6:	e8 fd fb ff ff       	call   8014f8 <close>
	return r;
  8018fb:	83 c4 10             	add    $0x10,%esp
  8018fe:	89 f3                	mov    %esi,%ebx
}
  801900:	89 d8                	mov    %ebx,%eax
  801902:	8d 65 f8             	lea    -0x8(%ebp),%esp
  801905:	5b                   	pop    %ebx
  801906:	5e                   	pop    %esi
  801907:	5d                   	pop    %ebp
  801908:	c3                   	ret    

00801909 <fsipc>:
// type: request code, passed as the simple integer IPC value.
// dstva: virtual address at which to receive reply page, 0 if none.
// Returns result from the file server.
static int
fsipc(unsigned type, void *dstva)
{
  801909:	55                   	push   %ebp
  80190a:	89 e5                	mov    %esp,%ebp
  80190c:	56                   	push   %esi
  80190d:	53                   	push   %ebx
  80190e:	89 c6                	mov    %eax,%esi
  801910:	89 d3                	mov    %edx,%ebx
	static envid_t fsenv;
	if (fsenv == 0)
  801912:	83 3d 00 40 80 00 00 	cmpl   $0x0,0x804000
  801919:	74 27                	je     801942 <fsipc+0x39>
	static_assert(sizeof(fsipcbuf) == PGSIZE);

	if (debug)
		cprintf("[%08x] fsipc %d %08x\n", thisenv->env_id, type, *(uint32_t *)&fsipcbuf);

	ipc_send(fsenv, type, &fsipcbuf, PTE_P | PTE_W | PTE_U);
  80191b:	6a 07                	push   $0x7
  80191d:	68 00 50 80 00       	push   $0x805000
  801922:	56                   	push   %esi
  801923:	ff 35 00 40 80 00    	pushl  0x804000
  801929:	e8 77 f9 ff ff       	call   8012a5 <ipc_send>
	return ipc_recv(NULL, dstva, NULL);
  80192e:	83 c4 0c             	add    $0xc,%esp
  801931:	6a 00                	push   $0x0
  801933:	53                   	push   %ebx
  801934:	6a 00                	push   $0x0
  801936:	e8 e9 f8 ff ff       	call   801224 <ipc_recv>
}
  80193b:	8d 65 f8             	lea    -0x8(%ebp),%esp
  80193e:	5b                   	pop    %ebx
  80193f:	5e                   	pop    %esi
  801940:	5d                   	pop    %ebp
  801941:	c3                   	ret    
		fsenv = ipc_find_env(ENV_TYPE_FS);
  801942:	83 ec 0c             	sub    $0xc,%esp
  801945:	6a 01                	push   $0x1
  801947:	e8 b1 f9 ff ff       	call   8012fd <ipc_find_env>
  80194c:	a3 00 40 80 00       	mov    %eax,0x804000
  801951:	83 c4 10             	add    $0x10,%esp
  801954:	eb c5                	jmp    80191b <fsipc+0x12>

00801956 <devfile_trunc>:
}

// Truncate or extend an open file to 'size' bytes
static int
devfile_trunc(struct Fd *fd, off_t newsize)
{
  801956:	f3 0f 1e fb          	endbr32 
  80195a:	55                   	push   %ebp
  80195b:	89 e5                	mov    %esp,%ebp
  80195d:	83 ec 08             	sub    $0x8,%esp
	fsipcbuf.set_size.req_fileid = fd->fd_file.id;
  801960:	8b 45 08             	mov    0x8(%ebp),%eax
  801963:	8b 40 0c             	mov    0xc(%eax),%eax
  801966:	a3 00 50 80 00       	mov    %eax,0x805000
	fsipcbuf.set_size.req_size = newsize;
  80196b:	8b 45 0c             	mov    0xc(%ebp),%eax
  80196e:	a3 04 50 80 00       	mov    %eax,0x805004
	return fsipc(FSREQ_SET_SIZE, NULL);
  801973:	ba 00 00 00 00       	mov    $0x0,%edx
  801978:	b8 02 00 00 00       	mov    $0x2,%eax
  80197d:	e8 87 ff ff ff       	call   801909 <fsipc>
}
  801982:	c9                   	leave  
  801983:	c3                   	ret    

00801984 <devfile_flush>:
{
  801984:	f3 0f 1e fb          	endbr32 
  801988:	55                   	push   %ebp
  801989:	89 e5                	mov    %esp,%ebp
  80198b:	83 ec 08             	sub    $0x8,%esp
	fsipcbuf.flush.req_fileid = fd->fd_file.id;
  80198e:	8b 45 08             	mov    0x8(%ebp),%eax
  801991:	8b 40 0c             	mov    0xc(%eax),%eax
  801994:	a3 00 50 80 00       	mov    %eax,0x805000
	return fsipc(FSREQ_FLUSH, NULL);
  801999:	ba 00 00 00 00       	mov    $0x0,%edx
  80199e:	b8 06 00 00 00       	mov    $0x6,%eax
  8019a3:	e8 61 ff ff ff       	call   801909 <fsipc>
}
  8019a8:	c9                   	leave  
  8019a9:	c3                   	ret    

008019aa <devfile_stat>:
{
  8019aa:	f3 0f 1e fb          	endbr32 
  8019ae:	55                   	push   %ebp
  8019af:	89 e5                	mov    %esp,%ebp
  8019b1:	53                   	push   %ebx
  8019b2:	83 ec 04             	sub    $0x4,%esp
  8019b5:	8b 5d 0c             	mov    0xc(%ebp),%ebx
	fsipcbuf.stat.req_fileid = fd->fd_file.id;
  8019b8:	8b 45 08             	mov    0x8(%ebp),%eax
  8019bb:	8b 40 0c             	mov    0xc(%eax),%eax
  8019be:	a3 00 50 80 00       	mov    %eax,0x805000
	if ((r = fsipc(FSREQ_STAT, NULL)) < 0)
  8019c3:	ba 00 00 00 00       	mov    $0x0,%edx
  8019c8:	b8 05 00 00 00       	mov    $0x5,%eax
  8019cd:	e8 37 ff ff ff       	call   801909 <fsipc>
  8019d2:	85 c0                	test   %eax,%eax
  8019d4:	78 2c                	js     801a02 <devfile_stat+0x58>
	strcpy(st->st_name, fsipcbuf.statRet.ret_name);
  8019d6:	83 ec 08             	sub    $0x8,%esp
  8019d9:	68 00 50 80 00       	push   $0x805000
  8019de:	53                   	push   %ebx
  8019df:	e8 ac ee ff ff       	call   800890 <strcpy>
	st->st_size = fsipcbuf.statRet.ret_size;
  8019e4:	a1 80 50 80 00       	mov    0x805080,%eax
  8019e9:	89 83 80 00 00 00    	mov    %eax,0x80(%ebx)
	st->st_isdir = fsipcbuf.statRet.ret_isdir;
  8019ef:	a1 84 50 80 00       	mov    0x805084,%eax
  8019f4:	89 83 84 00 00 00    	mov    %eax,0x84(%ebx)
	return 0;
  8019fa:	83 c4 10             	add    $0x10,%esp
  8019fd:	b8 00 00 00 00       	mov    $0x0,%eax
}
  801a02:	8b 5d fc             	mov    -0x4(%ebp),%ebx
  801a05:	c9                   	leave  
  801a06:	c3                   	ret    

00801a07 <devfile_write>:
{
  801a07:	f3 0f 1e fb          	endbr32 
  801a0b:	55                   	push   %ebp
  801a0c:	89 e5                	mov    %esp,%ebp
  801a0e:	83 ec 0c             	sub    $0xc,%esp
  801a11:	8b 45 10             	mov    0x10(%ebp),%eax
  801a14:	3d f8 0f 00 00       	cmp    $0xff8,%eax
  801a19:	ba f8 0f 00 00       	mov    $0xff8,%edx
  801a1e:	0f 47 c2             	cmova  %edx,%eax
	fsipcbuf.write.req_fileid = fd->fd_file.id;
  801a21:	8b 55 08             	mov    0x8(%ebp),%edx
  801a24:	8b 52 0c             	mov    0xc(%edx),%edx
  801a27:	89 15 00 50 80 00    	mov    %edx,0x805000
	fsipcbuf.write.req_n = n;
  801a2d:	a3 04 50 80 00       	mov    %eax,0x805004
	memmove(fsipcbuf.write.req_buf, buf, n);
  801a32:	50                   	push   %eax
  801a33:	ff 75 0c             	pushl  0xc(%ebp)
  801a36:	68 08 50 80 00       	push   $0x805008
  801a3b:	e8 06 f0 ff ff       	call   800a46 <memmove>
	return fsipc(FSREQ_WRITE, NULL);}
  801a40:	ba 00 00 00 00       	mov    $0x0,%edx
  801a45:	b8 04 00 00 00       	mov    $0x4,%eax
  801a4a:	e8 ba fe ff ff       	call   801909 <fsipc>
  801a4f:	c9                   	leave  
  801a50:	c3                   	ret    

00801a51 <devfile_read>:
{
  801a51:	f3 0f 1e fb          	endbr32 
  801a55:	55                   	push   %ebp
  801a56:	89 e5                	mov    %esp,%ebp
  801a58:	56                   	push   %esi
  801a59:	53                   	push   %ebx
  801a5a:	8b 75 10             	mov    0x10(%ebp),%esi
	fsipcbuf.read.req_fileid = fd->fd_file.id;
  801a5d:	8b 45 08             	mov    0x8(%ebp),%eax
  801a60:	8b 40 0c             	mov    0xc(%eax),%eax
  801a63:	a3 00 50 80 00       	mov    %eax,0x805000
	fsipcbuf.read.req_n = n;
  801a68:	89 35 04 50 80 00    	mov    %esi,0x805004
	if ((r = fsipc(FSREQ_READ, NULL)) < 0)
  801a6e:	ba 00 00 00 00       	mov    $0x0,%edx
  801a73:	b8 03 00 00 00       	mov    $0x3,%eax
  801a78:	e8 8c fe ff ff       	call   801909 <fsipc>
  801a7d:	89 c3                	mov    %eax,%ebx
  801a7f:	85 c0                	test   %eax,%eax
  801a81:	78 1f                	js     801aa2 <devfile_read+0x51>
	assert(r <= n);
  801a83:	39 f0                	cmp    %esi,%eax
  801a85:	77 24                	ja     801aab <devfile_read+0x5a>
	assert(r <= PGSIZE);
  801a87:	3d 00 10 00 00       	cmp    $0x1000,%eax
  801a8c:	7f 33                	jg     801ac1 <devfile_read+0x70>
	memmove(buf, fsipcbuf.readRet.ret_buf, r);
  801a8e:	83 ec 04             	sub    $0x4,%esp
  801a91:	50                   	push   %eax
  801a92:	68 00 50 80 00       	push   $0x805000
  801a97:	ff 75 0c             	pushl  0xc(%ebp)
  801a9a:	e8 a7 ef ff ff       	call   800a46 <memmove>
	return r;
  801a9f:	83 c4 10             	add    $0x10,%esp
}
  801aa2:	89 d8                	mov    %ebx,%eax
  801aa4:	8d 65 f8             	lea    -0x8(%ebp),%esp
  801aa7:	5b                   	pop    %ebx
  801aa8:	5e                   	pop    %esi
  801aa9:	5d                   	pop    %ebp
  801aaa:	c3                   	ret    
	assert(r <= n);
  801aab:	68 e8 29 80 00       	push   $0x8029e8
  801ab0:	68 ef 29 80 00       	push   $0x8029ef
  801ab5:	6a 7c                	push   $0x7c
  801ab7:	68 04 2a 80 00       	push   $0x802a04
  801abc:	e8 be 05 00 00       	call   80207f <_panic>
	assert(r <= PGSIZE);
  801ac1:	68 0f 2a 80 00       	push   $0x802a0f
  801ac6:	68 ef 29 80 00       	push   $0x8029ef
  801acb:	6a 7d                	push   $0x7d
  801acd:	68 04 2a 80 00       	push   $0x802a04
  801ad2:	e8 a8 05 00 00       	call   80207f <_panic>

00801ad7 <open>:
{
  801ad7:	f3 0f 1e fb          	endbr32 
  801adb:	55                   	push   %ebp
  801adc:	89 e5                	mov    %esp,%ebp
  801ade:	56                   	push   %esi
  801adf:	53                   	push   %ebx
  801ae0:	83 ec 1c             	sub    $0x1c,%esp
  801ae3:	8b 75 08             	mov    0x8(%ebp),%esi
	if (strlen(path) >= MAXPATHLEN)
  801ae6:	56                   	push   %esi
  801ae7:	e8 61 ed ff ff       	call   80084d <strlen>
  801aec:	83 c4 10             	add    $0x10,%esp
  801aef:	3d ff 03 00 00       	cmp    $0x3ff,%eax
  801af4:	7f 6c                	jg     801b62 <open+0x8b>
	if ((r = fd_alloc(&fd)) < 0)
  801af6:	83 ec 0c             	sub    $0xc,%esp
  801af9:	8d 45 f4             	lea    -0xc(%ebp),%eax
  801afc:	50                   	push   %eax
  801afd:	e8 67 f8 ff ff       	call   801369 <fd_alloc>
  801b02:	89 c3                	mov    %eax,%ebx
  801b04:	83 c4 10             	add    $0x10,%esp
  801b07:	85 c0                	test   %eax,%eax
  801b09:	78 3c                	js     801b47 <open+0x70>
	strcpy(fsipcbuf.open.req_path, path);
  801b0b:	83 ec 08             	sub    $0x8,%esp
  801b0e:	56                   	push   %esi
  801b0f:	68 00 50 80 00       	push   $0x805000
  801b14:	e8 77 ed ff ff       	call   800890 <strcpy>
	fsipcbuf.open.req_omode = mode;
  801b19:	8b 45 0c             	mov    0xc(%ebp),%eax
  801b1c:	a3 00 54 80 00       	mov    %eax,0x805400
	if ((r = fsipc(FSREQ_OPEN, fd)) < 0) {
  801b21:	8b 55 f4             	mov    -0xc(%ebp),%edx
  801b24:	b8 01 00 00 00       	mov    $0x1,%eax
  801b29:	e8 db fd ff ff       	call   801909 <fsipc>
  801b2e:	89 c3                	mov    %eax,%ebx
  801b30:	83 c4 10             	add    $0x10,%esp
  801b33:	85 c0                	test   %eax,%eax
  801b35:	78 19                	js     801b50 <open+0x79>
	return fd2num(fd);
  801b37:	83 ec 0c             	sub    $0xc,%esp
  801b3a:	ff 75 f4             	pushl  -0xc(%ebp)
  801b3d:	e8 f8 f7 ff ff       	call   80133a <fd2num>
  801b42:	89 c3                	mov    %eax,%ebx
  801b44:	83 c4 10             	add    $0x10,%esp
}
  801b47:	89 d8                	mov    %ebx,%eax
  801b49:	8d 65 f8             	lea    -0x8(%ebp),%esp
  801b4c:	5b                   	pop    %ebx
  801b4d:	5e                   	pop    %esi
  801b4e:	5d                   	pop    %ebp
  801b4f:	c3                   	ret    
		fd_close(fd, 0);
  801b50:	83 ec 08             	sub    $0x8,%esp
  801b53:	6a 00                	push   $0x0
  801b55:	ff 75 f4             	pushl  -0xc(%ebp)
  801b58:	e8 10 f9 ff ff       	call   80146d <fd_close>
		return r;
  801b5d:	83 c4 10             	add    $0x10,%esp
  801b60:	eb e5                	jmp    801b47 <open+0x70>
		return -E_BAD_PATH;
  801b62:	bb f4 ff ff ff       	mov    $0xfffffff4,%ebx
  801b67:	eb de                	jmp    801b47 <open+0x70>

00801b69 <sync>:


// Synchronize disk with buffer cache
int
sync(void)
{
  801b69:	f3 0f 1e fb          	endbr32 
  801b6d:	55                   	push   %ebp
  801b6e:	89 e5                	mov    %esp,%ebp
  801b70:	83 ec 08             	sub    $0x8,%esp
	// Ask the file server to update the disk
	// by writing any dirty blocks in the buffer cache.

	return fsipc(FSREQ_SYNC, NULL);
  801b73:	ba 00 00 00 00       	mov    $0x0,%edx
  801b78:	b8 08 00 00 00       	mov    $0x8,%eax
  801b7d:	e8 87 fd ff ff       	call   801909 <fsipc>
}
  801b82:	c9                   	leave  
  801b83:	c3                   	ret    

00801b84 <devpipe_stat>:
	return i;
}

static int
devpipe_stat(struct Fd *fd, struct Stat *stat)
{
  801b84:	f3 0f 1e fb          	endbr32 
  801b88:	55                   	push   %ebp
  801b89:	89 e5                	mov    %esp,%ebp
  801b8b:	56                   	push   %esi
  801b8c:	53                   	push   %ebx
  801b8d:	8b 5d 0c             	mov    0xc(%ebp),%ebx
	struct Pipe *p = (struct Pipe*) fd2data(fd);
  801b90:	83 ec 0c             	sub    $0xc,%esp
  801b93:	ff 75 08             	pushl  0x8(%ebp)
  801b96:	e8 b3 f7 ff ff       	call   80134e <fd2data>
  801b9b:	89 c6                	mov    %eax,%esi
	strcpy(stat->st_name, "<pipe>");
  801b9d:	83 c4 08             	add    $0x8,%esp
  801ba0:	68 1b 2a 80 00       	push   $0x802a1b
  801ba5:	53                   	push   %ebx
  801ba6:	e8 e5 ec ff ff       	call   800890 <strcpy>
	stat->st_size = p->p_wpos - p->p_rpos;
  801bab:	8b 46 04             	mov    0x4(%esi),%eax
  801bae:	2b 06                	sub    (%esi),%eax
  801bb0:	89 83 80 00 00 00    	mov    %eax,0x80(%ebx)
	stat->st_isdir = 0;
  801bb6:	c7 83 84 00 00 00 00 	movl   $0x0,0x84(%ebx)
  801bbd:	00 00 00 
	stat->st_dev = &devpipe;
  801bc0:	c7 83 88 00 00 00 28 	movl   $0x803028,0x88(%ebx)
  801bc7:	30 80 00 
	return 0;
}
  801bca:	b8 00 00 00 00       	mov    $0x0,%eax
  801bcf:	8d 65 f8             	lea    -0x8(%ebp),%esp
  801bd2:	5b                   	pop    %ebx
  801bd3:	5e                   	pop    %esi
  801bd4:	5d                   	pop    %ebp
  801bd5:	c3                   	ret    

00801bd6 <devpipe_close>:

static int
devpipe_close(struct Fd *fd)
{
  801bd6:	f3 0f 1e fb          	endbr32 
  801bda:	55                   	push   %ebp
  801bdb:	89 e5                	mov    %esp,%ebp
  801bdd:	53                   	push   %ebx
  801bde:	83 ec 0c             	sub    $0xc,%esp
  801be1:	8b 5d 08             	mov    0x8(%ebp),%ebx
	(void) sys_page_unmap(0, fd);
  801be4:	53                   	push   %ebx
  801be5:	6a 00                	push   $0x0
  801be7:	e8 73 f1 ff ff       	call   800d5f <sys_page_unmap>
	return sys_page_unmap(0, fd2data(fd));
  801bec:	89 1c 24             	mov    %ebx,(%esp)
  801bef:	e8 5a f7 ff ff       	call   80134e <fd2data>
  801bf4:	83 c4 08             	add    $0x8,%esp
  801bf7:	50                   	push   %eax
  801bf8:	6a 00                	push   $0x0
  801bfa:	e8 60 f1 ff ff       	call   800d5f <sys_page_unmap>
}
  801bff:	8b 5d fc             	mov    -0x4(%ebp),%ebx
  801c02:	c9                   	leave  
  801c03:	c3                   	ret    

00801c04 <_pipeisclosed>:
{
  801c04:	55                   	push   %ebp
  801c05:	89 e5                	mov    %esp,%ebp
  801c07:	57                   	push   %edi
  801c08:	56                   	push   %esi
  801c09:	53                   	push   %ebx
  801c0a:	83 ec 1c             	sub    $0x1c,%esp
  801c0d:	89 c7                	mov    %eax,%edi
  801c0f:	89 d6                	mov    %edx,%esi
		n = thisenv->env_runs;
  801c11:	a1 04 40 80 00       	mov    0x804004,%eax
  801c16:	8b 58 58             	mov    0x58(%eax),%ebx
		ret = pageref(fd) == pageref(p);
  801c19:	83 ec 0c             	sub    $0xc,%esp
  801c1c:	57                   	push   %edi
  801c1d:	e8 48 05 00 00       	call   80216a <pageref>
  801c22:	89 45 e4             	mov    %eax,-0x1c(%ebp)
  801c25:	89 34 24             	mov    %esi,(%esp)
  801c28:	e8 3d 05 00 00       	call   80216a <pageref>
		nn = thisenv->env_runs;
  801c2d:	8b 15 04 40 80 00    	mov    0x804004,%edx
  801c33:	8b 4a 58             	mov    0x58(%edx),%ecx
		if (n == nn)
  801c36:	83 c4 10             	add    $0x10,%esp
  801c39:	39 cb                	cmp    %ecx,%ebx
  801c3b:	74 1b                	je     801c58 <_pipeisclosed+0x54>
		if (n != nn && ret == 1)
  801c3d:	39 45 e4             	cmp    %eax,-0x1c(%ebp)
  801c40:	75 cf                	jne    801c11 <_pipeisclosed+0xd>
			cprintf("pipe race avoided\n", n, thisenv->env_runs, ret);
  801c42:	8b 42 58             	mov    0x58(%edx),%eax
  801c45:	6a 01                	push   $0x1
  801c47:	50                   	push   %eax
  801c48:	53                   	push   %ebx
  801c49:	68 22 2a 80 00       	push   $0x802a22
  801c4e:	e8 64 e6 ff ff       	call   8002b7 <cprintf>
  801c53:	83 c4 10             	add    $0x10,%esp
  801c56:	eb b9                	jmp    801c11 <_pipeisclosed+0xd>
		ret = pageref(fd) == pageref(p);
  801c58:	39 45 e4             	cmp    %eax,-0x1c(%ebp)
  801c5b:	0f 94 c0             	sete   %al
  801c5e:	0f b6 c0             	movzbl %al,%eax
}
  801c61:	8d 65 f4             	lea    -0xc(%ebp),%esp
  801c64:	5b                   	pop    %ebx
  801c65:	5e                   	pop    %esi
  801c66:	5f                   	pop    %edi
  801c67:	5d                   	pop    %ebp
  801c68:	c3                   	ret    

00801c69 <devpipe_write>:
{
  801c69:	f3 0f 1e fb          	endbr32 
  801c6d:	55                   	push   %ebp
  801c6e:	89 e5                	mov    %esp,%ebp
  801c70:	57                   	push   %edi
  801c71:	56                   	push   %esi
  801c72:	53                   	push   %ebx
  801c73:	83 ec 28             	sub    $0x28,%esp
  801c76:	8b 75 08             	mov    0x8(%ebp),%esi
	p = (struct Pipe*) fd2data(fd);
  801c79:	56                   	push   %esi
  801c7a:	e8 cf f6 ff ff       	call   80134e <fd2data>
  801c7f:	89 c3                	mov    %eax,%ebx
	for (i = 0; i < n; i++) {
  801c81:	83 c4 10             	add    $0x10,%esp
  801c84:	bf 00 00 00 00       	mov    $0x0,%edi
  801c89:	3b 7d 10             	cmp    0x10(%ebp),%edi
  801c8c:	74 4f                	je     801cdd <devpipe_write+0x74>
		while (p->p_wpos >= p->p_rpos + sizeof(p->p_buf)) {
  801c8e:	8b 43 04             	mov    0x4(%ebx),%eax
  801c91:	8b 0b                	mov    (%ebx),%ecx
  801c93:	8d 51 20             	lea    0x20(%ecx),%edx
  801c96:	39 d0                	cmp    %edx,%eax
  801c98:	72 14                	jb     801cae <devpipe_write+0x45>
			if (_pipeisclosed(fd, p))
  801c9a:	89 da                	mov    %ebx,%edx
  801c9c:	89 f0                	mov    %esi,%eax
  801c9e:	e8 61 ff ff ff       	call   801c04 <_pipeisclosed>
  801ca3:	85 c0                	test   %eax,%eax
  801ca5:	75 3b                	jne    801ce2 <devpipe_write+0x79>
			sys_yield();
  801ca7:	e8 03 f0 ff ff       	call   800caf <sys_yield>
  801cac:	eb e0                	jmp    801c8e <devpipe_write+0x25>
		p->p_buf[p->p_wpos % PIPEBUFSIZ] = buf[i];
  801cae:	8b 4d 0c             	mov    0xc(%ebp),%ecx
  801cb1:	0f b6 0c 39          	movzbl (%ecx,%edi,1),%ecx
  801cb5:	88 4d e7             	mov    %cl,-0x19(%ebp)
  801cb8:	89 c2                	mov    %eax,%edx
  801cba:	c1 fa 1f             	sar    $0x1f,%edx
  801cbd:	89 d1                	mov    %edx,%ecx
  801cbf:	c1 e9 1b             	shr    $0x1b,%ecx
  801cc2:	8d 14 08             	lea    (%eax,%ecx,1),%edx
  801cc5:	83 e2 1f             	and    $0x1f,%edx
  801cc8:	29 ca                	sub    %ecx,%edx
  801cca:	0f b6 4d e7          	movzbl -0x19(%ebp),%ecx
  801cce:	88 4c 13 08          	mov    %cl,0x8(%ebx,%edx,1)
		p->p_wpos++;
  801cd2:	83 c0 01             	add    $0x1,%eax
  801cd5:	89 43 04             	mov    %eax,0x4(%ebx)
	for (i = 0; i < n; i++) {
  801cd8:	83 c7 01             	add    $0x1,%edi
  801cdb:	eb ac                	jmp    801c89 <devpipe_write+0x20>
	return i;
  801cdd:	8b 45 10             	mov    0x10(%ebp),%eax
  801ce0:	eb 05                	jmp    801ce7 <devpipe_write+0x7e>
				return 0;
  801ce2:	b8 00 00 00 00       	mov    $0x0,%eax
}
  801ce7:	8d 65 f4             	lea    -0xc(%ebp),%esp
  801cea:	5b                   	pop    %ebx
  801ceb:	5e                   	pop    %esi
  801cec:	5f                   	pop    %edi
  801ced:	5d                   	pop    %ebp
  801cee:	c3                   	ret    

00801cef <devpipe_read>:
{
  801cef:	f3 0f 1e fb          	endbr32 
  801cf3:	55                   	push   %ebp
  801cf4:	89 e5                	mov    %esp,%ebp
  801cf6:	57                   	push   %edi
  801cf7:	56                   	push   %esi
  801cf8:	53                   	push   %ebx
  801cf9:	83 ec 18             	sub    $0x18,%esp
  801cfc:	8b 7d 08             	mov    0x8(%ebp),%edi
	p = (struct Pipe*)fd2data(fd);
  801cff:	57                   	push   %edi
  801d00:	e8 49 f6 ff ff       	call   80134e <fd2data>
  801d05:	89 c3                	mov    %eax,%ebx
	for (i = 0; i < n; i++) {
  801d07:	83 c4 10             	add    $0x10,%esp
  801d0a:	be 00 00 00 00       	mov    $0x0,%esi
  801d0f:	3b 75 10             	cmp    0x10(%ebp),%esi
  801d12:	75 14                	jne    801d28 <devpipe_read+0x39>
	return i;
  801d14:	8b 45 10             	mov    0x10(%ebp),%eax
  801d17:	eb 02                	jmp    801d1b <devpipe_read+0x2c>
				return i;
  801d19:	89 f0                	mov    %esi,%eax
}
  801d1b:	8d 65 f4             	lea    -0xc(%ebp),%esp
  801d1e:	5b                   	pop    %ebx
  801d1f:	5e                   	pop    %esi
  801d20:	5f                   	pop    %edi
  801d21:	5d                   	pop    %ebp
  801d22:	c3                   	ret    
			sys_yield();
  801d23:	e8 87 ef ff ff       	call   800caf <sys_yield>
		while (p->p_rpos == p->p_wpos) {
  801d28:	8b 03                	mov    (%ebx),%eax
  801d2a:	3b 43 04             	cmp    0x4(%ebx),%eax
  801d2d:	75 18                	jne    801d47 <devpipe_read+0x58>
			if (i > 0)
  801d2f:	85 f6                	test   %esi,%esi
  801d31:	75 e6                	jne    801d19 <devpipe_read+0x2a>
			if (_pipeisclosed(fd, p))
  801d33:	89 da                	mov    %ebx,%edx
  801d35:	89 f8                	mov    %edi,%eax
  801d37:	e8 c8 fe ff ff       	call   801c04 <_pipeisclosed>
  801d3c:	85 c0                	test   %eax,%eax
  801d3e:	74 e3                	je     801d23 <devpipe_read+0x34>
				return 0;
  801d40:	b8 00 00 00 00       	mov    $0x0,%eax
  801d45:	eb d4                	jmp    801d1b <devpipe_read+0x2c>
		buf[i] = p->p_buf[p->p_rpos % PIPEBUFSIZ];
  801d47:	99                   	cltd   
  801d48:	c1 ea 1b             	shr    $0x1b,%edx
  801d4b:	01 d0                	add    %edx,%eax
  801d4d:	83 e0 1f             	and    $0x1f,%eax
  801d50:	29 d0                	sub    %edx,%eax
  801d52:	0f b6 44 03 08       	movzbl 0x8(%ebx,%eax,1),%eax
  801d57:	8b 4d 0c             	mov    0xc(%ebp),%ecx
  801d5a:	88 04 31             	mov    %al,(%ecx,%esi,1)
		p->p_rpos++;
  801d5d:	83 03 01             	addl   $0x1,(%ebx)
	for (i = 0; i < n; i++) {
  801d60:	83 c6 01             	add    $0x1,%esi
  801d63:	eb aa                	jmp    801d0f <devpipe_read+0x20>

00801d65 <pipe>:
{
  801d65:	f3 0f 1e fb          	endbr32 
  801d69:	55                   	push   %ebp
  801d6a:	89 e5                	mov    %esp,%ebp
  801d6c:	56                   	push   %esi
  801d6d:	53                   	push   %ebx
  801d6e:	83 ec 1c             	sub    $0x1c,%esp
	if ((r = fd_alloc(&fd0)) < 0
  801d71:	8d 45 f4             	lea    -0xc(%ebp),%eax
  801d74:	50                   	push   %eax
  801d75:	e8 ef f5 ff ff       	call   801369 <fd_alloc>
  801d7a:	89 c3                	mov    %eax,%ebx
  801d7c:	83 c4 10             	add    $0x10,%esp
  801d7f:	85 c0                	test   %eax,%eax
  801d81:	0f 88 23 01 00 00    	js     801eaa <pipe+0x145>
	    || (r = sys_page_alloc(0, fd0, PTE_P|PTE_W|PTE_U|PTE_SHARE)) < 0)
  801d87:	83 ec 04             	sub    $0x4,%esp
  801d8a:	68 07 04 00 00       	push   $0x407
  801d8f:	ff 75 f4             	pushl  -0xc(%ebp)
  801d92:	6a 00                	push   $0x0
  801d94:	e8 39 ef ff ff       	call   800cd2 <sys_page_alloc>
  801d99:	89 c3                	mov    %eax,%ebx
  801d9b:	83 c4 10             	add    $0x10,%esp
  801d9e:	85 c0                	test   %eax,%eax
  801da0:	0f 88 04 01 00 00    	js     801eaa <pipe+0x145>
	if ((r = fd_alloc(&fd1)) < 0
  801da6:	83 ec 0c             	sub    $0xc,%esp
  801da9:	8d 45 f0             	lea    -0x10(%ebp),%eax
  801dac:	50                   	push   %eax
  801dad:	e8 b7 f5 ff ff       	call   801369 <fd_alloc>
  801db2:	89 c3                	mov    %eax,%ebx
  801db4:	83 c4 10             	add    $0x10,%esp
  801db7:	85 c0                	test   %eax,%eax
  801db9:	0f 88 db 00 00 00    	js     801e9a <pipe+0x135>
	    || (r = sys_page_alloc(0, fd1, PTE_P|PTE_W|PTE_U|PTE_SHARE)) < 0)
  801dbf:	83 ec 04             	sub    $0x4,%esp
  801dc2:	68 07 04 00 00       	push   $0x407
  801dc7:	ff 75 f0             	pushl  -0x10(%ebp)
  801dca:	6a 00                	push   $0x0
  801dcc:	e8 01 ef ff ff       	call   800cd2 <sys_page_alloc>
  801dd1:	89 c3                	mov    %eax,%ebx
  801dd3:	83 c4 10             	add    $0x10,%esp
  801dd6:	85 c0                	test   %eax,%eax
  801dd8:	0f 88 bc 00 00 00    	js     801e9a <pipe+0x135>
	va = fd2data(fd0);
  801dde:	83 ec 0c             	sub    $0xc,%esp
  801de1:	ff 75 f4             	pushl  -0xc(%ebp)
  801de4:	e8 65 f5 ff ff       	call   80134e <fd2data>
  801de9:	89 c6                	mov    %eax,%esi
	if ((r = sys_page_alloc(0, va, PTE_P|PTE_W|PTE_U|PTE_SHARE)) < 0)
  801deb:	83 c4 0c             	add    $0xc,%esp
  801dee:	68 07 04 00 00       	push   $0x407
  801df3:	50                   	push   %eax
  801df4:	6a 00                	push   $0x0
  801df6:	e8 d7 ee ff ff       	call   800cd2 <sys_page_alloc>
  801dfb:	89 c3                	mov    %eax,%ebx
  801dfd:	83 c4 10             	add    $0x10,%esp
  801e00:	85 c0                	test   %eax,%eax
  801e02:	0f 88 82 00 00 00    	js     801e8a <pipe+0x125>
	if ((r = sys_page_map(0, va, 0, fd2data(fd1), PTE_P|PTE_W|PTE_U|PTE_SHARE)) < 0)
  801e08:	83 ec 0c             	sub    $0xc,%esp
  801e0b:	ff 75 f0             	pushl  -0x10(%ebp)
  801e0e:	e8 3b f5 ff ff       	call   80134e <fd2data>
  801e13:	c7 04 24 07 04 00 00 	movl   $0x407,(%esp)
  801e1a:	50                   	push   %eax
  801e1b:	6a 00                	push   $0x0
  801e1d:	56                   	push   %esi
  801e1e:	6a 00                	push   $0x0
  801e20:	e8 f4 ee ff ff       	call   800d19 <sys_page_map>
  801e25:	89 c3                	mov    %eax,%ebx
  801e27:	83 c4 20             	add    $0x20,%esp
  801e2a:	85 c0                	test   %eax,%eax
  801e2c:	78 4e                	js     801e7c <pipe+0x117>
	fd0->fd_dev_id = devpipe.dev_id;
  801e2e:	a1 28 30 80 00       	mov    0x803028,%eax
  801e33:	8b 55 f4             	mov    -0xc(%ebp),%edx
  801e36:	89 02                	mov    %eax,(%edx)
	fd0->fd_omode = O_RDONLY;
  801e38:	8b 55 f4             	mov    -0xc(%ebp),%edx
  801e3b:	c7 42 08 00 00 00 00 	movl   $0x0,0x8(%edx)
	fd1->fd_dev_id = devpipe.dev_id;
  801e42:	8b 55 f0             	mov    -0x10(%ebp),%edx
  801e45:	89 02                	mov    %eax,(%edx)
	fd1->fd_omode = O_WRONLY;
  801e47:	8b 45 f0             	mov    -0x10(%ebp),%eax
  801e4a:	c7 40 08 01 00 00 00 	movl   $0x1,0x8(%eax)
	pfd[0] = fd2num(fd0);
  801e51:	83 ec 0c             	sub    $0xc,%esp
  801e54:	ff 75 f4             	pushl  -0xc(%ebp)
  801e57:	e8 de f4 ff ff       	call   80133a <fd2num>
  801e5c:	8b 4d 08             	mov    0x8(%ebp),%ecx
  801e5f:	89 01                	mov    %eax,(%ecx)
	pfd[1] = fd2num(fd1);
  801e61:	83 c4 04             	add    $0x4,%esp
  801e64:	ff 75 f0             	pushl  -0x10(%ebp)
  801e67:	e8 ce f4 ff ff       	call   80133a <fd2num>
  801e6c:	8b 4d 08             	mov    0x8(%ebp),%ecx
  801e6f:	89 41 04             	mov    %eax,0x4(%ecx)
	return 0;
  801e72:	83 c4 10             	add    $0x10,%esp
  801e75:	bb 00 00 00 00       	mov    $0x0,%ebx
  801e7a:	eb 2e                	jmp    801eaa <pipe+0x145>
	sys_page_unmap(0, va);
  801e7c:	83 ec 08             	sub    $0x8,%esp
  801e7f:	56                   	push   %esi
  801e80:	6a 00                	push   $0x0
  801e82:	e8 d8 ee ff ff       	call   800d5f <sys_page_unmap>
  801e87:	83 c4 10             	add    $0x10,%esp
	sys_page_unmap(0, fd1);
  801e8a:	83 ec 08             	sub    $0x8,%esp
  801e8d:	ff 75 f0             	pushl  -0x10(%ebp)
  801e90:	6a 00                	push   $0x0
  801e92:	e8 c8 ee ff ff       	call   800d5f <sys_page_unmap>
  801e97:	83 c4 10             	add    $0x10,%esp
	sys_page_unmap(0, fd0);
  801e9a:	83 ec 08             	sub    $0x8,%esp
  801e9d:	ff 75 f4             	pushl  -0xc(%ebp)
  801ea0:	6a 00                	push   $0x0
  801ea2:	e8 b8 ee ff ff       	call   800d5f <sys_page_unmap>
  801ea7:	83 c4 10             	add    $0x10,%esp
}
  801eaa:	89 d8                	mov    %ebx,%eax
  801eac:	8d 65 f8             	lea    -0x8(%ebp),%esp
  801eaf:	5b                   	pop    %ebx
  801eb0:	5e                   	pop    %esi
  801eb1:	5d                   	pop    %ebp
  801eb2:	c3                   	ret    

00801eb3 <pipeisclosed>:
{
  801eb3:	f3 0f 1e fb          	endbr32 
  801eb7:	55                   	push   %ebp
  801eb8:	89 e5                	mov    %esp,%ebp
  801eba:	83 ec 20             	sub    $0x20,%esp
	if ((r = fd_lookup(fdnum, &fd)) < 0)
  801ebd:	8d 45 f4             	lea    -0xc(%ebp),%eax
  801ec0:	50                   	push   %eax
  801ec1:	ff 75 08             	pushl  0x8(%ebp)
  801ec4:	e8 f6 f4 ff ff       	call   8013bf <fd_lookup>
  801ec9:	83 c4 10             	add    $0x10,%esp
  801ecc:	85 c0                	test   %eax,%eax
  801ece:	78 18                	js     801ee8 <pipeisclosed+0x35>
	p = (struct Pipe*) fd2data(fd);
  801ed0:	83 ec 0c             	sub    $0xc,%esp
  801ed3:	ff 75 f4             	pushl  -0xc(%ebp)
  801ed6:	e8 73 f4 ff ff       	call   80134e <fd2data>
  801edb:	89 c2                	mov    %eax,%edx
	return _pipeisclosed(fd, p);
  801edd:	8b 45 f4             	mov    -0xc(%ebp),%eax
  801ee0:	e8 1f fd ff ff       	call   801c04 <_pipeisclosed>
  801ee5:	83 c4 10             	add    $0x10,%esp
}
  801ee8:	c9                   	leave  
  801ee9:	c3                   	ret    

00801eea <devcons_close>:
	return tot;
}

static int
devcons_close(struct Fd *fd)
{
  801eea:	f3 0f 1e fb          	endbr32 
	USED(fd);

	return 0;
}
  801eee:	b8 00 00 00 00       	mov    $0x0,%eax
  801ef3:	c3                   	ret    

00801ef4 <devcons_stat>:

static int
devcons_stat(struct Fd *fd, struct Stat *stat)
{
  801ef4:	f3 0f 1e fb          	endbr32 
  801ef8:	55                   	push   %ebp
  801ef9:	89 e5                	mov    %esp,%ebp
  801efb:	83 ec 10             	sub    $0x10,%esp
	strcpy(stat->st_name, "<cons>");
  801efe:	68 3a 2a 80 00       	push   $0x802a3a
  801f03:	ff 75 0c             	pushl  0xc(%ebp)
  801f06:	e8 85 e9 ff ff       	call   800890 <strcpy>
	return 0;
}
  801f0b:	b8 00 00 00 00       	mov    $0x0,%eax
  801f10:	c9                   	leave  
  801f11:	c3                   	ret    

00801f12 <devcons_write>:
{
  801f12:	f3 0f 1e fb          	endbr32 
  801f16:	55                   	push   %ebp
  801f17:	89 e5                	mov    %esp,%ebp
  801f19:	57                   	push   %edi
  801f1a:	56                   	push   %esi
  801f1b:	53                   	push   %ebx
  801f1c:	81 ec 8c 00 00 00    	sub    $0x8c,%esp
	for (tot = 0; tot < n; tot += m) {
  801f22:	be 00 00 00 00       	mov    $0x0,%esi
		memmove(buf, (char*)vbuf + tot, m);
  801f27:	8d bd 68 ff ff ff    	lea    -0x98(%ebp),%edi
	for (tot = 0; tot < n; tot += m) {
  801f2d:	3b 75 10             	cmp    0x10(%ebp),%esi
  801f30:	73 31                	jae    801f63 <devcons_write+0x51>
		m = n - tot;
  801f32:	8b 5d 10             	mov    0x10(%ebp),%ebx
  801f35:	29 f3                	sub    %esi,%ebx
  801f37:	83 fb 7f             	cmp    $0x7f,%ebx
  801f3a:	b8 7f 00 00 00       	mov    $0x7f,%eax
  801f3f:	0f 47 d8             	cmova  %eax,%ebx
		memmove(buf, (char*)vbuf + tot, m);
  801f42:	83 ec 04             	sub    $0x4,%esp
  801f45:	53                   	push   %ebx
  801f46:	89 f0                	mov    %esi,%eax
  801f48:	03 45 0c             	add    0xc(%ebp),%eax
  801f4b:	50                   	push   %eax
  801f4c:	57                   	push   %edi
  801f4d:	e8 f4 ea ff ff       	call   800a46 <memmove>
		sys_cputs(buf, m);
  801f52:	83 c4 08             	add    $0x8,%esp
  801f55:	53                   	push   %ebx
  801f56:	57                   	push   %edi
  801f57:	e8 a6 ec ff ff       	call   800c02 <sys_cputs>
	for (tot = 0; tot < n; tot += m) {
  801f5c:	01 de                	add    %ebx,%esi
  801f5e:	83 c4 10             	add    $0x10,%esp
  801f61:	eb ca                	jmp    801f2d <devcons_write+0x1b>
}
  801f63:	89 f0                	mov    %esi,%eax
  801f65:	8d 65 f4             	lea    -0xc(%ebp),%esp
  801f68:	5b                   	pop    %ebx
  801f69:	5e                   	pop    %esi
  801f6a:	5f                   	pop    %edi
  801f6b:	5d                   	pop    %ebp
  801f6c:	c3                   	ret    

00801f6d <devcons_read>:
{
  801f6d:	f3 0f 1e fb          	endbr32 
  801f71:	55                   	push   %ebp
  801f72:	89 e5                	mov    %esp,%ebp
  801f74:	83 ec 08             	sub    $0x8,%esp
  801f77:	b8 00 00 00 00       	mov    $0x0,%eax
	if (n == 0)
  801f7c:	83 7d 10 00          	cmpl   $0x0,0x10(%ebp)
  801f80:	74 21                	je     801fa3 <devcons_read+0x36>
	while ((c = sys_cgetc()) == 0)
  801f82:	e8 9d ec ff ff       	call   800c24 <sys_cgetc>
  801f87:	85 c0                	test   %eax,%eax
  801f89:	75 07                	jne    801f92 <devcons_read+0x25>
		sys_yield();
  801f8b:	e8 1f ed ff ff       	call   800caf <sys_yield>
  801f90:	eb f0                	jmp    801f82 <devcons_read+0x15>
	if (c < 0)
  801f92:	78 0f                	js     801fa3 <devcons_read+0x36>
	if (c == 0x04)	// ctl-d is eof
  801f94:	83 f8 04             	cmp    $0x4,%eax
  801f97:	74 0c                	je     801fa5 <devcons_read+0x38>
	*(char*)vbuf = c;
  801f99:	8b 55 0c             	mov    0xc(%ebp),%edx
  801f9c:	88 02                	mov    %al,(%edx)
	return 1;
  801f9e:	b8 01 00 00 00       	mov    $0x1,%eax
}
  801fa3:	c9                   	leave  
  801fa4:	c3                   	ret    
		return 0;
  801fa5:	b8 00 00 00 00       	mov    $0x0,%eax
  801faa:	eb f7                	jmp    801fa3 <devcons_read+0x36>

00801fac <cputchar>:
{
  801fac:	f3 0f 1e fb          	endbr32 
  801fb0:	55                   	push   %ebp
  801fb1:	89 e5                	mov    %esp,%ebp
  801fb3:	83 ec 20             	sub    $0x20,%esp
	char c = ch;
  801fb6:	8b 45 08             	mov    0x8(%ebp),%eax
  801fb9:	88 45 f7             	mov    %al,-0x9(%ebp)
	sys_cputs(&c, 1);
  801fbc:	6a 01                	push   $0x1
  801fbe:	8d 45 f7             	lea    -0x9(%ebp),%eax
  801fc1:	50                   	push   %eax
  801fc2:	e8 3b ec ff ff       	call   800c02 <sys_cputs>
}
  801fc7:	83 c4 10             	add    $0x10,%esp
  801fca:	c9                   	leave  
  801fcb:	c3                   	ret    

00801fcc <getchar>:
{
  801fcc:	f3 0f 1e fb          	endbr32 
  801fd0:	55                   	push   %ebp
  801fd1:	89 e5                	mov    %esp,%ebp
  801fd3:	83 ec 1c             	sub    $0x1c,%esp
	r = read(0, &c, 1);
  801fd6:	6a 01                	push   $0x1
  801fd8:	8d 45 f7             	lea    -0x9(%ebp),%eax
  801fdb:	50                   	push   %eax
  801fdc:	6a 00                	push   $0x0
  801fde:	e8 5f f6 ff ff       	call   801642 <read>
	if (r < 0)
  801fe3:	83 c4 10             	add    $0x10,%esp
  801fe6:	85 c0                	test   %eax,%eax
  801fe8:	78 06                	js     801ff0 <getchar+0x24>
	if (r < 1)
  801fea:	74 06                	je     801ff2 <getchar+0x26>
	return c;
  801fec:	0f b6 45 f7          	movzbl -0x9(%ebp),%eax
}
  801ff0:	c9                   	leave  
  801ff1:	c3                   	ret    
		return -E_EOF;
  801ff2:	b8 f8 ff ff ff       	mov    $0xfffffff8,%eax
  801ff7:	eb f7                	jmp    801ff0 <getchar+0x24>

00801ff9 <iscons>:
{
  801ff9:	f3 0f 1e fb          	endbr32 
  801ffd:	55                   	push   %ebp
  801ffe:	89 e5                	mov    %esp,%ebp
  802000:	83 ec 20             	sub    $0x20,%esp
	if ((r = fd_lookup(fdnum, &fd)) < 0)
  802003:	8d 45 f4             	lea    -0xc(%ebp),%eax
  802006:	50                   	push   %eax
  802007:	ff 75 08             	pushl  0x8(%ebp)
  80200a:	e8 b0 f3 ff ff       	call   8013bf <fd_lookup>
  80200f:	83 c4 10             	add    $0x10,%esp
  802012:	85 c0                	test   %eax,%eax
  802014:	78 11                	js     802027 <iscons+0x2e>
	return fd->fd_dev_id == devcons.dev_id;
  802016:	8b 45 f4             	mov    -0xc(%ebp),%eax
  802019:	8b 15 44 30 80 00    	mov    0x803044,%edx
  80201f:	39 10                	cmp    %edx,(%eax)
  802021:	0f 94 c0             	sete   %al
  802024:	0f b6 c0             	movzbl %al,%eax
}
  802027:	c9                   	leave  
  802028:	c3                   	ret    

00802029 <opencons>:
{
  802029:	f3 0f 1e fb          	endbr32 
  80202d:	55                   	push   %ebp
  80202e:	89 e5                	mov    %esp,%ebp
  802030:	83 ec 24             	sub    $0x24,%esp
	if ((r = fd_alloc(&fd)) < 0)
  802033:	8d 45 f4             	lea    -0xc(%ebp),%eax
  802036:	50                   	push   %eax
  802037:	e8 2d f3 ff ff       	call   801369 <fd_alloc>
  80203c:	83 c4 10             	add    $0x10,%esp
  80203f:	85 c0                	test   %eax,%eax
  802041:	78 3a                	js     80207d <opencons+0x54>
	if ((r = sys_page_alloc(0, fd, PTE_P|PTE_U|PTE_W|PTE_SHARE)) < 0)
  802043:	83 ec 04             	sub    $0x4,%esp
  802046:	68 07 04 00 00       	push   $0x407
  80204b:	ff 75 f4             	pushl  -0xc(%ebp)
  80204e:	6a 00                	push   $0x0
  802050:	e8 7d ec ff ff       	call   800cd2 <sys_page_alloc>
  802055:	83 c4 10             	add    $0x10,%esp
  802058:	85 c0                	test   %eax,%eax
  80205a:	78 21                	js     80207d <opencons+0x54>
	fd->fd_dev_id = devcons.dev_id;
  80205c:	8b 45 f4             	mov    -0xc(%ebp),%eax
  80205f:	8b 15 44 30 80 00    	mov    0x803044,%edx
  802065:	89 10                	mov    %edx,(%eax)
	fd->fd_omode = O_RDWR;
  802067:	8b 45 f4             	mov    -0xc(%ebp),%eax
  80206a:	c7 40 08 02 00 00 00 	movl   $0x2,0x8(%eax)
	return fd2num(fd);
  802071:	83 ec 0c             	sub    $0xc,%esp
  802074:	50                   	push   %eax
  802075:	e8 c0 f2 ff ff       	call   80133a <fd2num>
  80207a:	83 c4 10             	add    $0x10,%esp
}
  80207d:	c9                   	leave  
  80207e:	c3                   	ret    

0080207f <_panic>:
 * It prints "panic: <message>", then causes a breakpoint exception,
 * which causes JOS to enter the JOS kernel monitor.
 */
void
_panic(const char *file, int line, const char *fmt, ...)
{
  80207f:	f3 0f 1e fb          	endbr32 
  802083:	55                   	push   %ebp
  802084:	89 e5                	mov    %esp,%ebp
  802086:	56                   	push   %esi
  802087:	53                   	push   %ebx
	va_list ap;

	va_start(ap, fmt);
  802088:	8d 5d 14             	lea    0x14(%ebp),%ebx

	// Print the panic message
	cprintf("[%08x] user panic in %s at %s:%d: ",
  80208b:	8b 35 08 30 80 00    	mov    0x803008,%esi
  802091:	e8 f6 eb ff ff       	call   800c8c <sys_getenvid>
  802096:	83 ec 0c             	sub    $0xc,%esp
  802099:	ff 75 0c             	pushl  0xc(%ebp)
  80209c:	ff 75 08             	pushl  0x8(%ebp)
  80209f:	56                   	push   %esi
  8020a0:	50                   	push   %eax
  8020a1:	68 48 2a 80 00       	push   $0x802a48
  8020a6:	e8 0c e2 ff ff       	call   8002b7 <cprintf>
		sys_getenvid(), binaryname, file, line);
	vcprintf(fmt, ap);
  8020ab:	83 c4 18             	add    $0x18,%esp
  8020ae:	53                   	push   %ebx
  8020af:	ff 75 10             	pushl  0x10(%ebp)
  8020b2:	e8 ab e1 ff ff       	call   800262 <vcprintf>
	cprintf("\n");
  8020b7:	c7 04 24 33 2a 80 00 	movl   $0x802a33,(%esp)
  8020be:	e8 f4 e1 ff ff       	call   8002b7 <cprintf>
  8020c3:	83 c4 10             	add    $0x10,%esp

	// Cause a breakpoint exception
	while (1)
		asm volatile("int3");
  8020c6:	cc                   	int3   
  8020c7:	eb fd                	jmp    8020c6 <_panic+0x47>

008020c9 <set_pgfault_handler>:
// at UXSTACKTOP), and tell the kernel to call the assembly-language
// _pgfault_upcall routine when a page fault occurs.
//
void
set_pgfault_handler(void (*handler)(struct UTrapframe *utf))
{
  8020c9:	f3 0f 1e fb          	endbr32 
  8020cd:	55                   	push   %ebp
  8020ce:	89 e5                	mov    %esp,%ebp
  8020d0:	83 ec 08             	sub    $0x8,%esp
	int r;

	if (_pgfault_handler == 0) {
  8020d3:	83 3d 00 60 80 00 00 	cmpl   $0x0,0x806000
  8020da:	74 27                	je     802103 <set_pgfault_handler+0x3a>
		if(sys_page_alloc(0,(void *)UXSTACKTOP-PGSIZE,PTE_W|PTE_U|PTE_P)<0)
			panic("set_pgfault_handler:sys_page_alloc failed");
	}

	// Save handler pointer for assembly to call.
	_pgfault_handler = handler;
  8020dc:	8b 45 08             	mov    0x8(%ebp),%eax
  8020df:	a3 00 60 80 00       	mov    %eax,0x806000
	if (sys_env_set_pgfault_upcall(thisenv->env_id,_pgfault_upcall)<0)	
  8020e4:	a1 04 40 80 00       	mov    0x804004,%eax
  8020e9:	8b 40 48             	mov    0x48(%eax),%eax
  8020ec:	83 ec 08             	sub    $0x8,%esp
  8020ef:	68 43 21 80 00       	push   $0x802143
  8020f4:	50                   	push   %eax
  8020f5:	e8 37 ed ff ff       	call   800e31 <sys_env_set_pgfault_upcall>
  8020fa:	83 c4 10             	add    $0x10,%esp
  8020fd:	85 c0                	test   %eax,%eax
  8020ff:	78 2e                	js     80212f <set_pgfault_handler+0x66>
        panic("set_pgfault_handler:sys_env_set_pgfault_upcall failed");
}
  802101:	c9                   	leave  
  802102:	c3                   	ret    
		if(sys_page_alloc(0,(void *)UXSTACKTOP-PGSIZE,PTE_W|PTE_U|PTE_P)<0)
  802103:	83 ec 04             	sub    $0x4,%esp
  802106:	6a 07                	push   $0x7
  802108:	68 00 f0 bf ee       	push   $0xeebff000
  80210d:	6a 00                	push   $0x0
  80210f:	e8 be eb ff ff       	call   800cd2 <sys_page_alloc>
  802114:	83 c4 10             	add    $0x10,%esp
  802117:	85 c0                	test   %eax,%eax
  802119:	79 c1                	jns    8020dc <set_pgfault_handler+0x13>
			panic("set_pgfault_handler:sys_page_alloc failed");
  80211b:	83 ec 04             	sub    $0x4,%esp
  80211e:	68 6c 2a 80 00       	push   $0x802a6c
  802123:	6a 21                	push   $0x21
  802125:	68 ce 2a 80 00       	push   $0x802ace
  80212a:	e8 50 ff ff ff       	call   80207f <_panic>
        panic("set_pgfault_handler:sys_env_set_pgfault_upcall failed");
  80212f:	83 ec 04             	sub    $0x4,%esp
  802132:	68 98 2a 80 00       	push   $0x802a98
  802137:	6a 27                	push   $0x27
  802139:	68 ce 2a 80 00       	push   $0x802ace
  80213e:	e8 3c ff ff ff       	call   80207f <_panic>

00802143 <_pgfault_upcall>:

.text
.globl _pgfault_upcall
_pgfault_upcall:
	// Call the C page fault handler.
	pushl %esp			// function argument: pointer to UTF
  802143:	54                   	push   %esp
	movl _pgfault_handler, %eax
  802144:	a1 00 60 80 00       	mov    0x806000,%eax
	call *%eax
  802149:	ff d0                	call   *%eax
	addl $4, %esp			// pop function argument
  80214b:	83 c4 04             	add    $0x4,%esp
	// may find that you have to rearrange your code in non-obvious
	// ways as registers become unavailable as scratch space.
	//
	// LAB 4: Your code here.
	//首先把此时的eip指针下移48个字节因为UTrapFrame的大小是48个字节
	movl 48(%esp), %ebp
  80214e:	8b 6c 24 30          	mov    0x30(%esp),%ebp
    subl $4, %ebp		// UTrapFrame.utf_esp - 4 and store back 这里是由于之前预留了4个字节。
  802152:	83 ed 04             	sub    $0x4,%ebp
    movl %ebp, 48(%esp)	// 返回上一次的esp位置。
  802155:	89 6c 24 30          	mov    %ebp,0x30(%esp)

	// Restore the trap-time registers.  After you do this, you
	// can no longer modify any general-purpose registers.
	// LAB 4: Your code here.
	movl 40(%esp), %eax 
  802159:	8b 44 24 28          	mov    0x28(%esp),%eax
    movl %eax, (%ebp)
  80215d:	89 45 00             	mov    %eax,0x0(%ebp)

	// Restore eflags from the stack.  After you do this, you can
	// no longer use arithmetic operations or anything else that
	// modifies eflags.
	// LAB 4: Your code here.
	addl $0x8, %esp         // Set %esp to the end of struct PushRegs
  802160:	83 c4 08             	add    $0x8,%esp
	popal                   // Restore the trap-time registers.(struct PushRegs)
  802163:	61                   	popa   

	// Switch back to the adjusted trap-time stack.
	// LAB 4: Your code here.
	addl $0x4, %esp         // now we are located at trap-time eip,so we have to increment %esp with 4.【跳过eip】
  802164:	83 c4 04             	add    $0x4,%esp
	popfl                   // Restore eflags register.	【pop eflags】
  802167:	9d                   	popf   
	popl %esp               // Just restore the adjusted trap-time stack pointer.
  802168:	5c                   	pop    %esp
							// 恢复esp

	// Return to re-execute the instruction that faulted.
	// LAB 4: Your code here.
	ret                     // We are now on the trap-time stack,since we have saved trap-time eip above trap-time esp,ret instruction will pop this trap-time eip to register %eip which known as PC at this time.Thus,we can return to re-execute the instruction that faulted.
  802169:	c3                   	ret    

0080216a <pageref>:
#include <inc/lib.h>

int
pageref(void *v)
{
  80216a:	f3 0f 1e fb          	endbr32 
  80216e:	55                   	push   %ebp
  80216f:	89 e5                	mov    %esp,%ebp
  802171:	8b 45 08             	mov    0x8(%ebp),%eax
	pte_t pte;

	if (!(uvpd[PDX(v)] & PTE_P))
  802174:	89 c2                	mov    %eax,%edx
  802176:	c1 ea 16             	shr    $0x16,%edx
  802179:	8b 0c 95 00 d0 7b ef 	mov    -0x10843000(,%edx,4),%ecx
		return 0;
  802180:	ba 00 00 00 00       	mov    $0x0,%edx
	if (!(uvpd[PDX(v)] & PTE_P))
  802185:	f6 c1 01             	test   $0x1,%cl
  802188:	74 1c                	je     8021a6 <pageref+0x3c>
	pte = uvpt[PGNUM(v)];
  80218a:	c1 e8 0c             	shr    $0xc,%eax
  80218d:	8b 04 85 00 00 40 ef 	mov    -0x10c00000(,%eax,4),%eax
	if (!(pte & PTE_P))
  802194:	a8 01                	test   $0x1,%al
  802196:	74 0e                	je     8021a6 <pageref+0x3c>
		return 0;
	return pages[PGNUM(pte)].pp_ref;
  802198:	c1 e8 0c             	shr    $0xc,%eax
  80219b:	0f b7 14 c5 04 00 00 	movzwl -0x10fffffc(,%eax,8),%edx
  8021a2:	ef 
  8021a3:	0f b7 d2             	movzwl %dx,%edx
}
  8021a6:	89 d0                	mov    %edx,%eax
  8021a8:	5d                   	pop    %ebp
  8021a9:	c3                   	ret    
  8021aa:	66 90                	xchg   %ax,%ax
  8021ac:	66 90                	xchg   %ax,%ax
  8021ae:	66 90                	xchg   %ax,%ax

008021b0 <__udivdi3>:
  8021b0:	f3 0f 1e fb          	endbr32 
  8021b4:	55                   	push   %ebp
  8021b5:	57                   	push   %edi
  8021b6:	56                   	push   %esi
  8021b7:	53                   	push   %ebx
  8021b8:	83 ec 1c             	sub    $0x1c,%esp
  8021bb:	8b 54 24 3c          	mov    0x3c(%esp),%edx
  8021bf:	8b 6c 24 30          	mov    0x30(%esp),%ebp
  8021c3:	8b 74 24 34          	mov    0x34(%esp),%esi
  8021c7:	8b 5c 24 38          	mov    0x38(%esp),%ebx
  8021cb:	85 d2                	test   %edx,%edx
  8021cd:	75 19                	jne    8021e8 <__udivdi3+0x38>
  8021cf:	39 f3                	cmp    %esi,%ebx
  8021d1:	76 4d                	jbe    802220 <__udivdi3+0x70>
  8021d3:	31 ff                	xor    %edi,%edi
  8021d5:	89 e8                	mov    %ebp,%eax
  8021d7:	89 f2                	mov    %esi,%edx
  8021d9:	f7 f3                	div    %ebx
  8021db:	89 fa                	mov    %edi,%edx
  8021dd:	83 c4 1c             	add    $0x1c,%esp
  8021e0:	5b                   	pop    %ebx
  8021e1:	5e                   	pop    %esi
  8021e2:	5f                   	pop    %edi
  8021e3:	5d                   	pop    %ebp
  8021e4:	c3                   	ret    
  8021e5:	8d 76 00             	lea    0x0(%esi),%esi
  8021e8:	39 f2                	cmp    %esi,%edx
  8021ea:	76 14                	jbe    802200 <__udivdi3+0x50>
  8021ec:	31 ff                	xor    %edi,%edi
  8021ee:	31 c0                	xor    %eax,%eax
  8021f0:	89 fa                	mov    %edi,%edx
  8021f2:	83 c4 1c             	add    $0x1c,%esp
  8021f5:	5b                   	pop    %ebx
  8021f6:	5e                   	pop    %esi
  8021f7:	5f                   	pop    %edi
  8021f8:	5d                   	pop    %ebp
  8021f9:	c3                   	ret    
  8021fa:	8d b6 00 00 00 00    	lea    0x0(%esi),%esi
  802200:	0f bd fa             	bsr    %edx,%edi
  802203:	83 f7 1f             	xor    $0x1f,%edi
  802206:	75 48                	jne    802250 <__udivdi3+0xa0>
  802208:	39 f2                	cmp    %esi,%edx
  80220a:	72 06                	jb     802212 <__udivdi3+0x62>
  80220c:	31 c0                	xor    %eax,%eax
  80220e:	39 eb                	cmp    %ebp,%ebx
  802210:	77 de                	ja     8021f0 <__udivdi3+0x40>
  802212:	b8 01 00 00 00       	mov    $0x1,%eax
  802217:	eb d7                	jmp    8021f0 <__udivdi3+0x40>
  802219:	8d b4 26 00 00 00 00 	lea    0x0(%esi,%eiz,1),%esi
  802220:	89 d9                	mov    %ebx,%ecx
  802222:	85 db                	test   %ebx,%ebx
  802224:	75 0b                	jne    802231 <__udivdi3+0x81>
  802226:	b8 01 00 00 00       	mov    $0x1,%eax
  80222b:	31 d2                	xor    %edx,%edx
  80222d:	f7 f3                	div    %ebx
  80222f:	89 c1                	mov    %eax,%ecx
  802231:	31 d2                	xor    %edx,%edx
  802233:	89 f0                	mov    %esi,%eax
  802235:	f7 f1                	div    %ecx
  802237:	89 c6                	mov    %eax,%esi
  802239:	89 e8                	mov    %ebp,%eax
  80223b:	89 f7                	mov    %esi,%edi
  80223d:	f7 f1                	div    %ecx
  80223f:	89 fa                	mov    %edi,%edx
  802241:	83 c4 1c             	add    $0x1c,%esp
  802244:	5b                   	pop    %ebx
  802245:	5e                   	pop    %esi
  802246:	5f                   	pop    %edi
  802247:	5d                   	pop    %ebp
  802248:	c3                   	ret    
  802249:	8d b4 26 00 00 00 00 	lea    0x0(%esi,%eiz,1),%esi
  802250:	89 f9                	mov    %edi,%ecx
  802252:	b8 20 00 00 00       	mov    $0x20,%eax
  802257:	29 f8                	sub    %edi,%eax
  802259:	d3 e2                	shl    %cl,%edx
  80225b:	89 54 24 08          	mov    %edx,0x8(%esp)
  80225f:	89 c1                	mov    %eax,%ecx
  802261:	89 da                	mov    %ebx,%edx
  802263:	d3 ea                	shr    %cl,%edx
  802265:	8b 4c 24 08          	mov    0x8(%esp),%ecx
  802269:	09 d1                	or     %edx,%ecx
  80226b:	89 f2                	mov    %esi,%edx
  80226d:	89 4c 24 08          	mov    %ecx,0x8(%esp)
  802271:	89 f9                	mov    %edi,%ecx
  802273:	d3 e3                	shl    %cl,%ebx
  802275:	89 c1                	mov    %eax,%ecx
  802277:	d3 ea                	shr    %cl,%edx
  802279:	89 f9                	mov    %edi,%ecx
  80227b:	89 5c 24 0c          	mov    %ebx,0xc(%esp)
  80227f:	89 eb                	mov    %ebp,%ebx
  802281:	d3 e6                	shl    %cl,%esi
  802283:	89 c1                	mov    %eax,%ecx
  802285:	d3 eb                	shr    %cl,%ebx
  802287:	09 de                	or     %ebx,%esi
  802289:	89 f0                	mov    %esi,%eax
  80228b:	f7 74 24 08          	divl   0x8(%esp)
  80228f:	89 d6                	mov    %edx,%esi
  802291:	89 c3                	mov    %eax,%ebx
  802293:	f7 64 24 0c          	mull   0xc(%esp)
  802297:	39 d6                	cmp    %edx,%esi
  802299:	72 15                	jb     8022b0 <__udivdi3+0x100>
  80229b:	89 f9                	mov    %edi,%ecx
  80229d:	d3 e5                	shl    %cl,%ebp
  80229f:	39 c5                	cmp    %eax,%ebp
  8022a1:	73 04                	jae    8022a7 <__udivdi3+0xf7>
  8022a3:	39 d6                	cmp    %edx,%esi
  8022a5:	74 09                	je     8022b0 <__udivdi3+0x100>
  8022a7:	89 d8                	mov    %ebx,%eax
  8022a9:	31 ff                	xor    %edi,%edi
  8022ab:	e9 40 ff ff ff       	jmp    8021f0 <__udivdi3+0x40>
  8022b0:	8d 43 ff             	lea    -0x1(%ebx),%eax
  8022b3:	31 ff                	xor    %edi,%edi
  8022b5:	e9 36 ff ff ff       	jmp    8021f0 <__udivdi3+0x40>
  8022ba:	66 90                	xchg   %ax,%ax
  8022bc:	66 90                	xchg   %ax,%ax
  8022be:	66 90                	xchg   %ax,%ax

008022c0 <__umoddi3>:
  8022c0:	f3 0f 1e fb          	endbr32 
  8022c4:	55                   	push   %ebp
  8022c5:	57                   	push   %edi
  8022c6:	56                   	push   %esi
  8022c7:	53                   	push   %ebx
  8022c8:	83 ec 1c             	sub    $0x1c,%esp
  8022cb:	8b 44 24 3c          	mov    0x3c(%esp),%eax
  8022cf:	8b 74 24 30          	mov    0x30(%esp),%esi
  8022d3:	8b 5c 24 34          	mov    0x34(%esp),%ebx
  8022d7:	8b 7c 24 38          	mov    0x38(%esp),%edi
  8022db:	85 c0                	test   %eax,%eax
  8022dd:	75 19                	jne    8022f8 <__umoddi3+0x38>
  8022df:	39 df                	cmp    %ebx,%edi
  8022e1:	76 5d                	jbe    802340 <__umoddi3+0x80>
  8022e3:	89 f0                	mov    %esi,%eax
  8022e5:	89 da                	mov    %ebx,%edx
  8022e7:	f7 f7                	div    %edi
  8022e9:	89 d0                	mov    %edx,%eax
  8022eb:	31 d2                	xor    %edx,%edx
  8022ed:	83 c4 1c             	add    $0x1c,%esp
  8022f0:	5b                   	pop    %ebx
  8022f1:	5e                   	pop    %esi
  8022f2:	5f                   	pop    %edi
  8022f3:	5d                   	pop    %ebp
  8022f4:	c3                   	ret    
  8022f5:	8d 76 00             	lea    0x0(%esi),%esi
  8022f8:	89 f2                	mov    %esi,%edx
  8022fa:	39 d8                	cmp    %ebx,%eax
  8022fc:	76 12                	jbe    802310 <__umoddi3+0x50>
  8022fe:	89 f0                	mov    %esi,%eax
  802300:	89 da                	mov    %ebx,%edx
  802302:	83 c4 1c             	add    $0x1c,%esp
  802305:	5b                   	pop    %ebx
  802306:	5e                   	pop    %esi
  802307:	5f                   	pop    %edi
  802308:	5d                   	pop    %ebp
  802309:	c3                   	ret    
  80230a:	8d b6 00 00 00 00    	lea    0x0(%esi),%esi
  802310:	0f bd e8             	bsr    %eax,%ebp
  802313:	83 f5 1f             	xor    $0x1f,%ebp
  802316:	75 50                	jne    802368 <__umoddi3+0xa8>
  802318:	39 d8                	cmp    %ebx,%eax
  80231a:	0f 82 e0 00 00 00    	jb     802400 <__umoddi3+0x140>
  802320:	89 d9                	mov    %ebx,%ecx
  802322:	39 f7                	cmp    %esi,%edi
  802324:	0f 86 d6 00 00 00    	jbe    802400 <__umoddi3+0x140>
  80232a:	89 d0                	mov    %edx,%eax
  80232c:	89 ca                	mov    %ecx,%edx
  80232e:	83 c4 1c             	add    $0x1c,%esp
  802331:	5b                   	pop    %ebx
  802332:	5e                   	pop    %esi
  802333:	5f                   	pop    %edi
  802334:	5d                   	pop    %ebp
  802335:	c3                   	ret    
  802336:	8d b4 26 00 00 00 00 	lea    0x0(%esi,%eiz,1),%esi
  80233d:	8d 76 00             	lea    0x0(%esi),%esi
  802340:	89 fd                	mov    %edi,%ebp
  802342:	85 ff                	test   %edi,%edi
  802344:	75 0b                	jne    802351 <__umoddi3+0x91>
  802346:	b8 01 00 00 00       	mov    $0x1,%eax
  80234b:	31 d2                	xor    %edx,%edx
  80234d:	f7 f7                	div    %edi
  80234f:	89 c5                	mov    %eax,%ebp
  802351:	89 d8                	mov    %ebx,%eax
  802353:	31 d2                	xor    %edx,%edx
  802355:	f7 f5                	div    %ebp
  802357:	89 f0                	mov    %esi,%eax
  802359:	f7 f5                	div    %ebp
  80235b:	89 d0                	mov    %edx,%eax
  80235d:	31 d2                	xor    %edx,%edx
  80235f:	eb 8c                	jmp    8022ed <__umoddi3+0x2d>
  802361:	8d b4 26 00 00 00 00 	lea    0x0(%esi,%eiz,1),%esi
  802368:	89 e9                	mov    %ebp,%ecx
  80236a:	ba 20 00 00 00       	mov    $0x20,%edx
  80236f:	29 ea                	sub    %ebp,%edx
  802371:	d3 e0                	shl    %cl,%eax
  802373:	89 44 24 08          	mov    %eax,0x8(%esp)
  802377:	89 d1                	mov    %edx,%ecx
  802379:	89 f8                	mov    %edi,%eax
  80237b:	d3 e8                	shr    %cl,%eax
  80237d:	8b 4c 24 08          	mov    0x8(%esp),%ecx
  802381:	89 54 24 04          	mov    %edx,0x4(%esp)
  802385:	8b 54 24 04          	mov    0x4(%esp),%edx
  802389:	09 c1                	or     %eax,%ecx
  80238b:	89 d8                	mov    %ebx,%eax
  80238d:	89 4c 24 08          	mov    %ecx,0x8(%esp)
  802391:	89 e9                	mov    %ebp,%ecx
  802393:	d3 e7                	shl    %cl,%edi
  802395:	89 d1                	mov    %edx,%ecx
  802397:	d3 e8                	shr    %cl,%eax
  802399:	89 e9                	mov    %ebp,%ecx
  80239b:	89 7c 24 0c          	mov    %edi,0xc(%esp)
  80239f:	d3 e3                	shl    %cl,%ebx
  8023a1:	89 c7                	mov    %eax,%edi
  8023a3:	89 d1                	mov    %edx,%ecx
  8023a5:	89 f0                	mov    %esi,%eax
  8023a7:	d3 e8                	shr    %cl,%eax
  8023a9:	89 e9                	mov    %ebp,%ecx
  8023ab:	89 fa                	mov    %edi,%edx
  8023ad:	d3 e6                	shl    %cl,%esi
  8023af:	09 d8                	or     %ebx,%eax
  8023b1:	f7 74 24 08          	divl   0x8(%esp)
  8023b5:	89 d1                	mov    %edx,%ecx
  8023b7:	89 f3                	mov    %esi,%ebx
  8023b9:	f7 64 24 0c          	mull   0xc(%esp)
  8023bd:	89 c6                	mov    %eax,%esi
  8023bf:	89 d7                	mov    %edx,%edi
  8023c1:	39 d1                	cmp    %edx,%ecx
  8023c3:	72 06                	jb     8023cb <__umoddi3+0x10b>
  8023c5:	75 10                	jne    8023d7 <__umoddi3+0x117>
  8023c7:	39 c3                	cmp    %eax,%ebx
  8023c9:	73 0c                	jae    8023d7 <__umoddi3+0x117>
  8023cb:	2b 44 24 0c          	sub    0xc(%esp),%eax
  8023cf:	1b 54 24 08          	sbb    0x8(%esp),%edx
  8023d3:	89 d7                	mov    %edx,%edi
  8023d5:	89 c6                	mov    %eax,%esi
  8023d7:	89 ca                	mov    %ecx,%edx
  8023d9:	0f b6 4c 24 04       	movzbl 0x4(%esp),%ecx
  8023de:	29 f3                	sub    %esi,%ebx
  8023e0:	19 fa                	sbb    %edi,%edx
  8023e2:	89 d0                	mov    %edx,%eax
  8023e4:	d3 e0                	shl    %cl,%eax
  8023e6:	89 e9                	mov    %ebp,%ecx
  8023e8:	d3 eb                	shr    %cl,%ebx
  8023ea:	d3 ea                	shr    %cl,%edx
  8023ec:	09 d8                	or     %ebx,%eax
  8023ee:	83 c4 1c             	add    $0x1c,%esp
  8023f1:	5b                   	pop    %ebx
  8023f2:	5e                   	pop    %esi
  8023f3:	5f                   	pop    %edi
  8023f4:	5d                   	pop    %ebp
  8023f5:	c3                   	ret    
  8023f6:	8d b4 26 00 00 00 00 	lea    0x0(%esi,%eiz,1),%esi
  8023fd:	8d 76 00             	lea    0x0(%esi),%esi
  802400:	29 fe                	sub    %edi,%esi
  802402:	19 c3                	sbb    %eax,%ebx
  802404:	89 f2                	mov    %esi,%edx
  802406:	89 d9                	mov    %ebx,%ecx
  802408:	e9 1d ff ff ff       	jmp    80232a <__umoddi3+0x6a>
